Snippets

Peter Scargill grafana.sh

Created by Peter Scargill last modified
#!/bin/bash
# Create InfluxDB and Grafana 4.4.3 (latest)
source /etc/os-release
OPSYS=${ID^^}
sudo apt-get -y update
sudo apt-get install -y apt-transport-https curl
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "16.04" && echo "deb https://repos.influxdata.com/ubuntu xenial stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
curl https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
[[ $OPSYS == *"BIAN"* ]] && [[ $(uname -m) == *"armv6"* ]] && echo "deb https://dl.bintray.com/fg2it/deb-rpi-1b jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
[[ $OPSYS == *"BIAN"* ]] && [[ $(uname -m) == *"armv7l"* ]] && echo "deb https://dl.bintray.com/fg2it/deb jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
[[ $OPSYS == *"UBUNTU"* ]] && [[ $(uname -m) == *"aarch64"* ]] && sudo dpkg --add-architecture armhf && echo "deb [arch=armhf] https://dl.bintray.com/fg2it/deb jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
[[ $OPSYS == *"UBUNTU"* ]] && [[ $(uname -m) != *"aarch64"* ]] && echo "deb https://dl.bintray.com/fg2it/deb jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get -y remove --purge grafana grafana-data
sudo rm -rf /var/log/grafana /etc/grafana
sudo apt-get -y autoremove
sudo apt-get -y update
if [[ $(uname -m) == *"aarch64"* ]]; then
	sudo apt-get install -y influxdb grafana:armhf
else
	sudo apt-get install -y influxdb grafana
fi
#sudo sed -i -e 's/.*auth-enabled = false/  auth-enabled = true/g' /etc/influxdb/influxdb.conf
sudo systemctl daemon-reload
sudo systemctl enable influxdb
sudo systemctl start influxdb
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
sudo wget https://dl.influxdata.com/chronograf/nightlies/chronograf_nightly_armhf.deb
sudo dpkg -i chronograf_nightly_armhf.deb
sudo systemctl enable chronograf
sudo systemctl start chronograf

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.