forked from ainblockchain/ain-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_monitoring_gcp.sh
More file actions
47 lines (34 loc) · 1.07 KB
/
setup_monitoring_gcp.sh
File metadata and controls
47 lines (34 loc) · 1.07 KB
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
#!/bin/sh
if [ "$#" -lt 1 ]; then
echo "Usage: sh setup_monitoring_gcp.sh [dev|staging|spring|summer]"
echo "Example: sh setup_monitoring_gcp.sh dev"
exit
fi
if [ "$1" != 'spring' ] && [ "$1" != 'summer' ] && [ "$1" != 'dev' ] && [ "$1" != 'staging' ]; then
echo "Invalid season argument: $1"
exit
fi
SEASON="$1"
echo 'Killing old jobs..'
killall prometheus
killall grafana-server
echo 'Setting up working directory..'
cd
sudo rm -rf ../ain-blockchain
sudo mkdir ../ain-blockchain
sudo chmod 777 ../ain-blockchain
mv * ../ain-blockchain
cd ../ain-blockchain
echo 'Installing Prometheus..'
curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest \
| grep browser_download_url \
| grep linux-amd64 \
| cut -d '"' -f 4 \
| wget -qi -
tar xvf prometheus*.tar.gz
echo 'Renaming Prometheus folder..'
mv prometheus*/ prometheus
echo 'Copying Prometheus yml file..'
PROMETHEUS_CONFIG_FILE="prometheus-${SEASON}.yml"
echo "PROMETHEUS_CONFIG_FILE=${PROMETHEUS_CONFIG_FILE}"
cp -f monitoring/${PROMETHEUS_CONFIG_FILE} prometheus/prometheus.yml