add systemclt function 4 services
This commit is contained in:
parent
4141feec39
commit
ae70c60700
22
grafana.sh
22
grafana.sh
|
@ -23,6 +23,11 @@ if [ "$MODE" = "debug" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
run_service() {
|
||||||
|
systemclt enable $1
|
||||||
|
systemctl restart $1
|
||||||
|
systemctl status $1
|
||||||
|
}
|
||||||
MAIN_TEL="/etc/telegraf/telegraf.conf"
|
MAIN_TEL="/etc/telegraf/telegraf.conf"
|
||||||
TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf"
|
TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf"
|
||||||
GRAFANA_INI="/etc/grafana/grafana.ini"
|
GRAFANA_INI="/etc/grafana/grafana.ini"
|
||||||
|
@ -39,8 +44,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 influxdb -y
|
apt update && apt install influxdb -y
|
||||||
systemctl enable influxdb
|
run_service influxdb
|
||||||
systemctl status influxdb
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Setup Grafana Packages
|
# Setup Grafana Packages
|
||||||
|
@ -48,8 +52,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 update && apt install grafana -y
|
||||||
systemctl enable grafana-server
|
run_service grafana-server
|
||||||
systemctl status grafana-server
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Setup Telegraf Packages
|
# Setup Telegraf Packages
|
||||||
|
@ -110,9 +113,7 @@ cat << JITSI_TELEGRAF > $TEL_JIT
|
||||||
|
|
||||||
JITSI_TELEGRAF
|
JITSI_TELEGRAF
|
||||||
|
|
||||||
systemctl enable telegraf
|
run_service telegraf
|
||||||
systemctl restart telegraf
|
|
||||||
systemctl status telegraf
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Setup videobridge options
|
# Setup videobridge options
|
||||||
|
@ -132,6 +133,7 @@ sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI
|
||||||
sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI
|
sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI
|
||||||
sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI
|
sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI
|
||||||
systemctl restart grafana-server
|
systemctl restart grafana-server
|
||||||
|
systemctl status grafana-server
|
||||||
|
|
||||||
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
|
||||||
|
@ -151,7 +153,7 @@ curl -X PUT -H "Content-Type: application/json" -d "{
|
||||||
\"oldPassword\": \"admin\",
|
\"oldPassword\": \"admin\",
|
||||||
\"newPassword\": \"$GRAFANA_PASS\",
|
\"newPassword\": \"$GRAFANA_PASS\",
|
||||||
\"confirmNew\": \"$GRAFANA_PASS\"
|
\"confirmNew\": \"$GRAFANA_PASS\"
|
||||||
}" http://admin:admin@localhost:3000/grafana/api/user/password
|
}" http://admin:admin@localhost:3000/api/user/password
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Create InfluxDB datasource
|
# Create InfluxDB datasource
|
||||||
|
@ -165,12 +167,12 @@ POST -H 'Content-Type: application/json;charset=UTF-8' -d \
|
||||||
"access":"proxy",
|
"access":"proxy",
|
||||||
"isDefault":true,
|
"isDefault":true,
|
||||||
"database":"jitsi"
|
"database":"jitsi"
|
||||||
}' http://admin:$GRAFANA_PASS@localhost:3000/grafana/api/datasources
|
}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Add Grafana Dashboard
|
# Add Grafana Dashboard
|
||||||
"
|
"
|
||||||
grafana_host="http://localhost:3000/grafana"
|
grafana_host="http://localhost:3000"
|
||||||
grafana_cred="admin:$GRAFANA_PASS"
|
grafana_cred="admin:$GRAFANA_PASS"
|
||||||
grafana_datasource="InfluxDB"
|
grafana_datasource="InfluxDB"
|
||||||
ds=(11969);
|
ds=(11969);
|
||||||
|
|
Loading…
Reference in New Issue