forked from switnet/quick-jibri-installer
parent
7f13eeafb3
commit
c7ad6b34c9
46
grafana.sh
46
grafana.sh
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
while getopts m: option
|
while getopts m: option
|
||||||
do
|
do
|
||||||
case "${option}"
|
case "${option}"
|
||||||
in
|
in
|
||||||
m) MODE=${OPTARG};;
|
m) MODE=${OPTARG};;
|
||||||
\?) echo "Usage: sudo ./grafana.sh [-m debug]" && exit;;
|
\?) echo "Usage: sudo ./grafana.sh [-m debug]" && exit;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
#DEBUG
|
||||||
|
@ -51,14 +51,18 @@ WS_CONF="/etc/nginx/sites-enabled/$DOMAIN.conf"
|
||||||
GRAFANA_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)"
|
GRAFANA_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)"
|
||||||
|
|
||||||
# Min requirements
|
# Min requirements
|
||||||
apt update && apt install -y gnupg2 curl wget jq
|
apt-get update && \
|
||||||
|
apt-get install -y gnupg2 \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
jq
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Setup InfluxDB Packages
|
# Setup InfluxDB Packages
|
||||||
"
|
"
|
||||||
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
|
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
|
||||||
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
|
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
|
||||||
apt update && apt install influxdb -y
|
apt-get update && apt-get install influxdb -y
|
||||||
run_service influxdb
|
run_service influxdb
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
@ -66,7 +70,7 @@ echo "
|
||||||
"
|
"
|
||||||
curl -s https://packages.grafana.com/gpg.key | sudo apt-key add -
|
curl -s https://packages.grafana.com/gpg.key | sudo apt-key add -
|
||||||
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
|
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
|
||||||
apt update && apt install grafana -y
|
apt-get update && apt-get install grafana -y
|
||||||
run_service grafana-server
|
run_service grafana-server
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
@ -74,7 +78,7 @@ echo "
|
||||||
"
|
"
|
||||||
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
|
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
|
||||||
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
|
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
|
||||||
apt update && apt install telegraf -y
|
apt-get update && apt-get install telegraf -y
|
||||||
mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.original
|
mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.original
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
@ -159,13 +163,13 @@ while [ $secs -gt 0 ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f $WS_CONF ]; then
|
if [ -f $WS_CONF ]; then
|
||||||
sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF
|
sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF
|
||||||
sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" $WS_CONF
|
sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" $WS_CONF
|
||||||
sed -i "/Anything that didn't match above/i \ \ \ \ }" $WS_CONF
|
sed -i "/Anything that didn't match above/i \ \ \ \ }" $WS_CONF
|
||||||
sed -i "/Anything that didn't match above/i \\\n" $WS_CONF
|
sed -i "/Anything that didn't match above/i \\\n" $WS_CONF
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
else
|
else
|
||||||
echo "No app configuration done to server file, please report to:
|
echo "No app configuration done to server file, please report to:
|
||||||
-> https://github.com/switnet-ltd/quick-jibri-installer/issues"
|
-> https://github.com/switnet-ltd/quick-jibri-installer/issues"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -186,12 +190,12 @@ echo "
|
||||||
curl -s -k -u "admin:$GRAFANA_PASS" -X \
|
curl -s -k -u "admin:$GRAFANA_PASS" -X \
|
||||||
POST -H 'Content-Type: application/json;charset=UTF-8' -d \
|
POST -H 'Content-Type: application/json;charset=UTF-8' -d \
|
||||||
'{
|
'{
|
||||||
"name": "InfluxDB",
|
"name": "InfluxDB",
|
||||||
"type": "influxdb",
|
"type": "influxdb",
|
||||||
"url": "http://localhost:8086",
|
"url": "http://localhost:8086",
|
||||||
"access": "proxy",
|
"access": "proxy",
|
||||||
"isDefault": true,
|
"isDefault": true,
|
||||||
"database": "jitsi"
|
"database": "jitsi"
|
||||||
}' http://localhost:3000/api/datasources; echo ""
|
}' http://localhost:3000/api/datasources; echo ""
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
|
Loading…
Reference in New Issue