diff --git a/sh_scripts/prometheus.sh b/sh_scripts/prometheus.sh new file mode 100644 index 0000000..4459594 --- /dev/null +++ b/sh_scripts/prometheus.sh @@ -0,0 +1,150 @@ +#/bin/bash +clear +echo "################################################" +echo "# #" +echo "# #" +echo "# Prometheus #" +echo "# Quick Installer #" +echo "# #" +echo "# by #" +echo "# johanneskr.de #" +echo "# #" +echo "# #" +echo "################################################" +echo "" +echo "" +echo "DE >" +echo "Dieses Script startet gleich automatisch. Es installiert Prometheus + Node_Exporter automatisch, so das du es dann bei Grafana gleich einbinden kannst." +echo "" +echo "EN >" +echo "This script will start automatically. It installs Prometheus + Node_Exporter automatically, so that you can integrate it into Grafana right away." +sleep 5 +echo "" +echo "" +echo "" +echo "LETS GO!" + +sudo groupadd --system prometheus +sudo useradd -s /sbin/nologin --system -g prometheus prometheus +sudo mkdir /var/lib/prometheus +for i in rules rules.d files_sd; do sudo mkdir -p /etc/prometheus/${i}; done + +sudo apt-get -y install wget +mkdir -p /tmp/prometheus && cd /tmp/prometheus +curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest \ + | grep browser_download_url \ + | grep linux-amd64 \ + | cut -d '"' -f 4 \ + | wget -qi - + +tar xvf prometheus*.tar.gz +cd prometheus*/ +sudo mv prometheus promtool /usr/local/bin/ +sudo mv prometheus.yml /etc/prometheus/prometheus.yml +sudo tee /etc/prometheus/prometheus.yml<` to any timeseries scraped from this config. + - job_name: 'prometheus' + + # metrics_path defaults to '/metrics' + # scheme defaults to 'http'. + + static_configs: + - targets: ['localhost:9090'] + + - job_name: 'node_exporter' + static_configs: + - targets: ['localhost:9100'] +EOF; done + +sudo tee /etc/systemd/system/prometheus.service<" +echo "Wenn alles geklappt hat, funktioniert Prometheus und Node_Exporter wunderbar!" +echo "Beides kannst du unter http://:9090/ und http://:9100 erreichen" +echo "EN >" +echo "If everything went well, Prometheus and Node_Exporter will work wonderfully!" +echo "You can access both at http://:9090/ and http://:9100" +echo "" +echo "###############################################################################" \ No newline at end of file