-
-
Save Subhasis180689/f0f94c242fe2355f46e0433c6550ca55 to your computer and use it in GitHub Desktop.
Shell Script to Install Grafana, Prometheus and Alertmanager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Get Host IP to be used in alertmanager and prometheus | |
ip=$(ifconfig | grep "inet " | grep 10 | awk '{print $2}') | |
## Create Folder for prometheus database | |
mkdir /prom-data | |
chmod 777 /prom-data/ | |
## install grafana | |
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm | |
systemctl enable grafana-server | |
systemctl start grafana-server | |
#install alertmanager | |
cd /home/centos | |
curl -LO https://github.com/prometheus/alertmanager/releases/download/v0.11.0/alertmanager-0.11.0.linux-amd64.tar.gz | |
tar -zxvf alertmanager-0.11.0.linux-amd64.tar.gz && mv alertmanager-0.11.0.linux-amd64 alertmanager | |
cd alertmanager | |
nohup ./alertmanager --log.level debug --config.file simple.yml --web.external-url=http://$ip:9093/alertmanager & | |
## install prometheus | |
cd /home/centos | |
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.1.0/prometheus-2.1.0.linux-amd64.tar.gz | |
tar -zxvf prometheus-2.1.0.linux-amd64.tar.gz && mv prometheus-2.1.0.linux-amd64 prometheus | |
cd prometheus | |
curl -LO https://gist.githubusercontent.com/rashidcmb/107a69635c07df62a84a73ffb6f92c12/raw/918e28560397ec4401f4af528be13df59b0d8b96/prometheus-nodes.yml | |
mv -f prometheus-nodes.yml prometheus.yml | |
touch nodes.json | |
nohup ./prometheus --storage.tsdb.path=/prom-data --storage.tsdb.retention=365d --web.external-url=http://$ip:9098/prometheus --config.file=/home/centos/prometheus/prometheus.yml & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment