Add labs
This commit is contained in:
57
04-mosquitto/lab13/docker-compose-mosquitto.yml
Normal file
57
04-mosquitto/lab13/docker-compose-mosquitto.yml
Normal file
@ -0,0 +1,57 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
mosquitto:
|
||||
image: eclipse-mosquitto:latest
|
||||
container_name: mosquitto
|
||||
ports:
|
||||
- "1883:1883"
|
||||
- "9001:9001"
|
||||
volumes:
|
||||
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf
|
||||
|
||||
mosquitto-exporter:
|
||||
image: sapcc/mosquitto-exporter:latest
|
||||
container_name: mosquitto-exporter
|
||||
environment:
|
||||
- "BROKER_ENDPOINT=tcp://mosquitto:1883"
|
||||
depends_on:
|
||||
- mosquitto
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter:latest
|
||||
container_name: node-exporter
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.rootfs=/rootfs'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
container_name: prometheus
|
||||
volumes:
|
||||
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
|
||||
- prometheus_data:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
|
||||
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
|
||||
volumes:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
49
04-mosquitto/lab13/docker-compose.yml
Normal file
49
04-mosquitto/lab13/docker-compose.yml
Normal file
@ -0,0 +1,49 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
|
||||
mosquitto-exporter:
|
||||
image: sapcc/mosquitto-exporter:latest
|
||||
container_name: mosquitto-exporter
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
environment:
|
||||
- "BROKER_ENDPOINT=tcp://host.docker.internal:1883"
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter:latest
|
||||
container_name: node-exporter
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.rootfs=/rootfs'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
container_name: prometheus
|
||||
volumes:
|
||||
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
|
||||
- prometheus_data:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
|
||||
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
|
||||
volumes:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
@ -0,0 +1,14 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: 'Default'
|
||||
orgId: 1
|
||||
folder: ''
|
||||
type: file
|
||||
disableDeletion: false
|
||||
editable: true
|
||||
options:
|
||||
path: /etc/grafana/provisioning/dashboards
|
||||
jsonData:
|
||||
DS_PROMETHEUS: Prometheus
|
||||
DS_LOCALHOST: Prometheus
|
||||
1831
04-mosquitto/lab13/grafana/provisioning/dashboards/mosquitto.json
Normal file
1831
04-mosquitto/lab13/grafana/provisioning/dashboards/mosquitto.json
Normal file
File diff suppressed because it is too large
Load Diff
15765
04-mosquitto/lab13/grafana/provisioning/dashboards/node-exporter.json
Normal file
15765
04-mosquitto/lab13/grafana/provisioning/dashboards/node-exporter.json
Normal file
File diff suppressed because it is too large
Load Diff
2707
04-mosquitto/lab13/grafana/provisioning/dashboards/prometheus.json
Normal file
2707
04-mosquitto/lab13/grafana/provisioning/dashboards/prometheus.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,8 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
18
04-mosquitto/lab13/lab.txt
Normal file
18
04-mosquitto/lab13/lab.txt
Normal file
@ -0,0 +1,18 @@
|
||||
= Monitoring Prometheus
|
||||
|
||||
Verwenden Sie Prometheus und Grafana, z.B. aus dem beigefügten docker-compose Setup.
|
||||
|
||||
$ docker compose up
|
||||
|
||||
(In docker bereits vorkonfiguriert:)
|
||||
Konfigurieren Sie den Prometheus-Exporter als Scrape Target in Prometheus.
|
||||
Installieren Sie die Dashboards: 1860, 11054, 22739
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'mosquitto'
|
||||
static_configs:
|
||||
- targets: ['mosquitto-exporter:9234']
|
||||
|
||||
|
||||
Rufen Sie Grafana über http://localhost:3000 auf.
|
||||
Sie können sich mittels "admin/admin" anmelden.
|
||||
8
04-mosquitto/lab13/mosquitto.conf
Normal file
8
04-mosquitto/lab13/mosquitto.conf
Normal file
@ -0,0 +1,8 @@
|
||||
listener 1883
|
||||
listener_allow_anonymous true
|
||||
|
||||
persistence true
|
||||
persistence_location /mosquitto/data/
|
||||
#log_dest file /mosquitto/log/mosquitto.log
|
||||
|
||||
sys_interval 10
|
||||
37
04-mosquitto/lab13/prometheus.yaml
Normal file
37
04-mosquitto/lab13/prometheus.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'mosquitto'
|
||||
static_configs:
|
||||
- targets: ['mosquitto-exporter:9234']
|
||||
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
|
||||
- job_name: prometheus
|
||||
honor_timestamps: true
|
||||
track_timestamps_staleness: false
|
||||
scrape_interval: 15s
|
||||
scrape_timeout: 10s
|
||||
scrape_protocols:
|
||||
- OpenMetricsText1.0.0
|
||||
- OpenMetricsText0.0.1
|
||||
- PrometheusText1.0.0
|
||||
- PrometheusText0.0.4
|
||||
scrape_native_histograms: false
|
||||
always_scrape_classic_histograms: false
|
||||
convert_classic_histograms_to_nhcb: false
|
||||
metrics_path: /metrics
|
||||
scheme: http
|
||||
enable_compression: true
|
||||
metric_name_validation_scheme: utf8
|
||||
metric_name_escaping_scheme: allow-utf-8
|
||||
follow_redirects: true
|
||||
enable_http2: true
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost:9090
|
||||
labels:
|
||||
app: prometheus
|
||||
Reference in New Issue
Block a user