forked from testdasi/grafana-unraid-stack-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
46 lines (40 loc) · 1.83 KB
/
install.sh
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
#!/bin/bash
# install more packages
apt-get -y update \
&& apt-get -y install wget apt-transport-https software-properties-common gnupg gnupg2 gnupg1 lm-sensors smartmontools ipmitool curl unzip jq
# add grafana repo
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list
# add telegraf repo
wget -qO- https://repos.influxdata.com/influxdb.key | apt-key add -
echo "deb https://repos.influxdata.com/debian buster stable" | tee /etc/apt/sources.list.d/influxdb.list
# install grafana telegraf influxdb hddtemp
apt-get -y update \
&& apt-get -y install grafana telegraf influxdb hddtemp
# install loki and promtail
LOKI_RELEASE=$(curl -sX GET "https://api.github.com/repos/grafana/loki/releases/latest" | jq -r .tag_name)
LOKI_VER=${LOKI_RELEASE#v} \
&& cd /tmp \
&& curl -O -L "https://github.com/grafana/loki/releases/download/v${LOKI_VER}/loki-linux-amd64.zip" \
&& curl -O -L "https://github.com/grafana/loki/releases/download/v${LOKI_VER}/promtail-linux-amd64.zip" \
&& unzip "loki-linux-amd64.zip" \
&& chmod a+x "loki-linux-amd64" \
&& mv loki-linux-amd64 /usr/sbin/loki \
&& rm -f loki-linux-amd64.zip \
&& unzip "promtail-linux-amd64.zip" \
&& chmod a+x "promtail-linux-amd64" \
&& mv promtail-linux-amd64 /usr/sbin/promtail \
&& rm -f promtail-linux-amd64 \
&& echo "$(date "+%d.%m.%Y %T") Added loki and promtail binary release ${LOKI_RELEASE}" >> /build_date.info
# clean config
rm -f /etc/default/grafana-server \
&& touch /etc/default/grafana-server
rm -f /etc/hddtemp.db
rm -rf /etc/telegraf
rm -rf /etc/influxdb
rm -rf /etc/grafana
# clean up
apt-get -y autoremove \
&& apt-get -y autoclean \
&& apt-get -y clean \
&& rm -fr /tmp/* /var/tmp/* /var/lib/apt/lists/*