Grafana Prometheus Docker install: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (10 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
=Ordner Struktur erstellen= | =Ordner Struktur erstellen= | ||
| − | + | *mkdir grafana | |
| + | *cd grafana | ||
*<span style="background:yellow">mkdir -p data/prometheus grafana-lib prometheus </span> | *<span style="background:yellow">mkdir -p data/prometheus grafana-lib prometheus </span> | ||
| Zeile 71: | Zeile 72: | ||
- job_name: kali | - job_name: kali | ||
static_configs: | static_configs: | ||
| − | - targets: [' | + | - targets: ['xxx.xxx.xxx.xxx:xxxx'] |
</pre> | </pre> | ||
| + | |||
| + | Bei targets einen Rechner, auf dem ein node-exporter läuft angeben. | ||
=docker container starten= | =docker container starten= | ||
| Zeile 85: | Zeile 88: | ||
=Linux node-exporter= | =Linux node-exporter= | ||
*apt install prometheus-node-exporter | *apt install prometheus-node-exporter | ||
| + | *systemctl enable prometheus-node-exporter --now | ||
=Grafana= | =Grafana= | ||
| + | ==Datenquelle hinzufügen== | ||
[[Datei:Grafana-prometheus-1.png|700px]] | [[Datei:Grafana-prometheus-1.png|700px]] | ||
[[Datei:Grafana-prometheus-2.png]] | [[Datei:Grafana-prometheus-2.png]] | ||
| − | + | ==Template hinzufügen== | |
| + | *https://grafana.com/grafana/dashboards/11074 | ||
[[Datei:Grafana-prometheus-3.png]] | [[Datei:Grafana-prometheus-3.png]] | ||
| Zeile 96: | Zeile 102: | ||
[[Datei:Grafana-prometheus-5.png|800px]] | [[Datei:Grafana-prometheus-5.png|800px]] | ||
| + | |||
| + | =Windows Node Exporter= | ||
| + | ==Download und Installation== | ||
| + | *https://github.com/prometheus-community/windows_exporter/releases | ||
| + | ==Anlegen in Prometheus== | ||
| + | - job_name: win10 | ||
| + | static_configs: | ||
| + | - targets: ['10.10.10.11:9182'] | ||
| + | ==Restart des Containers== | ||
| + | *docker-compose down ; docker-compose up -d | ||
| + | ==Import des Grafana Templates== | ||
| + | ;https://grafana.com/grafana/dashboards/2129 | ||
| + | ;oder | ||
| + | *https://grafana.com/grafana/dashboards/14694 | ||
| + | |||
| + | ==Import angepasstes Dashboard== | ||
| + | *[[Datei:windows_dashboard.json]] Datei herunterladen | ||
| + | |||
| + | In der Webgui: | ||
| + | * "+" Symbol drücken | ||
| + | **Import | ||
| + | ***Import JSON file | ||
Aktuelle Version vom 2. Februar 2023, 15:22 Uhr
Ordner Struktur erstellen
- mkdir grafana
- cd grafana
- mkdir -p data/prometheus grafana-lib prometheus
docker-compose.yml
version: "3"
networks:
monitor-net:
driver: bridge
services:
grafana:
image: grafana/grafana
ports:
- 3000:3000
volumes:
- "./grafana-lib:/var/lib/grafana"
# - "./grafana-etc:/etc/grafana"
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel, michaeldmoore-multistat-panel, briangann-datatable-panel, grafana-worldmap-panel, grafana-piechart-panel
user: "472"
networks:
- monitor-net
prometheus:
image: prom/prometheus
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./data/prometheus:/prometheus
ports:
- 9090:9090
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-admin-api'
networks:
- monitor-net
prometheus.yml
- vi prometheus/prometheus.yml
# my global config
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'my-ext'
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
- 'alert.rules'
# - "first.rules"
# - "second.rules"
# alert
alerting:
# alertmanagers:
# - scheme: http
# static_configs:
# - targets:
# - "alertmanager:9093"
scrape_configs:
- job_name: kali
static_configs:
- targets: ['xxx.xxx.xxx.xxx:xxxx']
Bei targets einen Rechner, auf dem ein node-exporter läuft angeben.
docker container starten
- docker-compose up -d
Login
- http://localhost:3000/
- user: admin
- pass: admin
- Passwörter ändern
Linux node-exporter
- apt install prometheus-node-exporter
- systemctl enable prometheus-node-exporter --now
Grafana
Datenquelle hinzufügen
Template hinzufügen
Windows Node Exporter
Download und Installation
Anlegen in Prometheus
- job_name: win10 static_configs: - targets: ['10.10.10.11:9182']
Restart des Containers
- docker-compose down ; docker-compose up -d
Import des Grafana Templates
Import angepasstes Dashboard
- Datei:Windows dashboard.json Datei herunterladen
In der Webgui:
- "+" Symbol drücken
- Import
- Import JSON file
- Import


