-
Notifications
You must be signed in to change notification settings - Fork 1
/
08_prom_grafana_thanos.sh
executable file
·64 lines (45 loc) · 2.26 KB
/
08_prom_grafana_thanos.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
57
58
59
60
61
62
63
64
#! /bin/bash
set -eo pipefail
source ./common.sh
#./08_prom_grafana_thanos.sh -d true
while getopts d: option; do
case "${option}" in
d)
echo "-d delete was triggered, Parameter: ${OPTARG}";
helm delete prom;
kubectl delete crd prometheuses.monitoring.coreos.com;
kubectl delete crd prometheusrules.monitoring.coreos.com;
kubectl delete crd servicemonitors.monitoring.coreos.com;
kubectl delete crd podmonitors.monitoring.coreos.com;
kubectl delete crd alertmanagers.monitoring.coreos.com;
helm delete thanos;
exit 1
;;
\?)
echo "Invalid option: ${OPTARG}";
exit 1
;;
esac
done
#Get Access Keys still
AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key) && export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id) && export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
j2 modules/prom/prometheus-operator/object-store.yaml.j2 > modules/prom/prometheus-operator/object-store.yaml --undefined
# Create Monitoring Namespace
kubectl apply -f modules/prom/namespace.yml
helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com
helm repo update
helm upgrade --install thanos --namespace monitoring banzaicloud-stable/thanos --set-file objstoreFile=modules/prom/prometheus-operator/object-store.yaml
# Create Secret for Prom
kubectl -n monitoring create secret generic thanos-objstore-config --from-file=modules/prom/prometheus-operator/object-store.yaml || true
# Create Prom
helm upgrade --install prom --namespace monitoring ./modules/prom/prometheus-operator
kubectl --namespace monitoring get pods -l "release=prom"
# Different ways to load tests
#while sleep 1; do curl http://elb.com/; done
#echo "GET http://a821119f3115911eaadd50e0cca30225-1605152951.us-west-2.elb.amazonaws.com/" | vegeta attack -rate=50/s -duration=1m | vegeta encode > results.json && vegeta report results.json && rm -rf results.json
# echo 'GET http://a821119f3115911eaadd50e0cca30225-1605152951.us-west-2.elb.amazonaws.com' | \
# vegeta attack -rate 50/s -duration 30s | vegeta encode \
# jaggr @count=rps \
# hist\[100,200,300,400,500\]:code | \
# jplot rps+code.hist.100+code.hist.200+code.hist.300+code.hist.400+code.hist.500 \