Prometheus_Node-Explorer_Gr.../README.md

203 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p align="center">
## Prometheus Node-Explorer Grafana
</p>
## Prometheus docker Install
Docker installation
<code>apt update && apt upgrade
apt install curl</code>
<code>curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh</code>
<code>docker volume create prometheus-data
docker volume create prometheus-conf</code>
<pre><span>docker run \
-p 9090:9090 \
-v prometheus-data:/prometheus \
-v prometheus-conf:/etc/prometheus \
--name prometheus \
--restart=always
prom/prometheus:latest </pre></span>
Wer die Retention Time setzen möchte fügt folgendes hinzu. (Aufbewahrungszeit)
<code>--storage.tsdb.retention.time=30d --config.file=/etc/prometheus/prometheus.yml</code>
Prometheus Konfiguration prometheus.yml
<pre><span># my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["localhost:9090"]
# Weitere Server sind Optional
- job_name: "Server-1"
static_configs:
- targets: ["127.0.0.1:9100"]
- job_name: "Server-2"
static_configs:
- targets: ["127.0.0.1:9100"]
- job_name: "Server-3"
static_configs:
- targets: ["127.0.0.1:9100"]
</pre></span>
## Node Exporter installieren
Ordner erstellen, Node Exporter Download, Entpacken, Ordner öffnen
Node Exporter testweise starten
<pre><span>
mkdir /opt/node_exporter
cd /opt/node_exporter
wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
tar xvfz node_exporter-1.3.1.linux-amd64.tar.gz
cd node_exporter-*.*-amd64
./node_exporter </pre></span>
<p><a href="https://github.com/prometheus/node_exporter/releases" target="_blank">Github Node-Exporter</a></p>
Start Skript für Node Exporter
<pre>nano /etc/systemd/system/node_exporter.service</pre>
<pre><span>[Unit]
Description=Node Exporter
[Service]
User=root
Group=root
#EnvironmentFile=-/etc/sysconfig/node_exporter
ExecStart=/opt/node_exporter/node_exporter-1.3.1.linux-amd64/node_exporter
[Install]
WantedBy=multi-user.target </pre></span>
<pre><span>systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter
systemctl status node_exporter</pre></span>
## Node Exporter mit Docker starten (Alternative)
<pre><span>docker run -d \
--net="host" \
--pid="host" \
--name=NOEX \
--restart=always \
-v "/:/host:ro,rslave" \
quay.io/prometheus/node-exporter:latest \
--path.rootfs=/host</pre></span>
## Grafana Docker installieren
<pre><span>docker run \
-p 3000:3000 \
-v grafana-data:/var/lib/grafana \
--restart=always \
--name grafana \
grafana/grafana:latest</pre></span>
<p>Schritt-f&uuml;r-Schritt-Anleitung f&uuml;r die Konfiguration eines Panels:</p>
<ol>
<li>
<p><strong>Einloggen ins Panel:</strong></p>
<ul>
<li>&Ouml;ffne deinen Webbrowser und gehe zur Login-Seite des Panels.</li>
<li>Verwende die folgenden Zugangsdaten:
<ul>
<code> IP:3000 </code>
<li>Name: admin</li>
<li>Passwort: admin</li>
</ul>
</li>
</ul>
</li>
<li>
<p><strong>Navigieren zu Verbindungen:</strong></p>
<ul>
<li>Nachdem du eingeloggt bist, suche nach den drei horizontalen Strichen oder einem Men&uuml;symbol, das normalerweise in der oberen Ecke zu finden ist.</li>
<li>Klicke darauf und w&auml;hle die Option "Verbindungen" aus.</li>
</ul>
</li>
<li>
<p><strong>Neue Verbindung hinzuf&uuml;gen:</strong></p>
<ul>
<li>In der Verbindungen-Seite klicke auf "Neue Verbindung hinzuf&uuml;gen".</li>
<li>W&auml;hle "Prometheus" aus.</li>
</ul>
</li>
<li>
<p><strong>Einstellungen f&uuml;r die Verbindung:</strong></p>
<ul>
<li>Belasse den Namen der Verbindung unver&auml;ndert.</li>
<li>Trage die Prometheus-Server-URL ein, ersetze dabei <code>&lt;IP&gt;</code> durch die entsprechende IP-Adresse: http://&lt;IP&gt;:9100</li>
</ul>
</li>
<li>
<p><strong>Speichern und Testen:</strong></p>
<ul>
<li>Nachdem alle erforderlichen Informationen eingetragen wurden, klicke auf "Save &amp; Test".</li>
<li>Wenn alles korrekt gemacht wurde, sollte eine Erfolgsmeldung erscheinen.</li>
</ul>
</li>
<li>
<p><strong>Dashboard-Konfiguration:</strong></p>
<ul>
<li>Gehe zum Dashboard und w&auml;hle "Neu" aus.</li>
<li>Klicke auf "Dashboard importieren".</li>
<li>Gib die Nummer "1860" ein.</li>
<li>Klicke auf "Laden".</li>
<li>W&auml;hle die Datenbank "Prometheus" aus.</li>
<li>Klicke abschlie&szlig;end auf "Import".</li>
</ul>
</li>
</ol>
<p>Durch das Befolgen dieser Schritte solltest du das Panel erfolgreich konfiguriert haben.</p>