(01)
#more dock-compose.yml
version: ‘3.8’
services:
mysqld-exporter:
image: prom/mysqld-exporter:v0.14.0
container_name: mysqld-exporter
ports:
- 9104:9104
environment:
- DATA_SOURCE_NAME=mysql_exporter:boco1234@(192.168.100.201:3306)/
- TZ=Asia/Shanghai
otel-collector:
image: otel/opentelemetry-collector:0.50.0
container_name: otel-collector
command: [ “–config=/etc/otel-collector-config.yaml” ]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
expose:
- 55678
(02)
#more otel-collector-config.yaml
receivers:
prometheus:
config:
scrape_configs:
- job_name: ‘mysql-monitoring’
scrape_interval: 5s
static_configs:
- targets: [‘mysql-exporter:9104’]
labels:
host_name: boco201
processors:
batch:
exporters:
otlp:
endpoint: 192.168.100.201:11800
tls:
insecure: true
service:
pipelines:
metrics:
receivers:
- prometheus
processors:
- batch
exporters:
- otlp
(03)
#docker compose -f ./dock-compose.yml up -d
WARN[0000] /usr/share/skywalking9.7.0/config/dock-compose.yml: version
is obsolete
[+] Running 8/8
✔ otel-collector Pulled 19.2s
✔ 4c75b05145f9 Pull complete 3.6s
✔ b110427d6a1c Pull complete 12.8s
✔ 533c18546c82 Pull complete 5.3s
✔ mysqld-exporter Pulled 9.5s
✔ 009932687766 Pull complete 2.7s
✔ ff9264fbb6f4 Pull complete 2.6s
✔ 1516dd896e5e Pull complete 4.4s
[+] Running 3/3
✔ Network config_default Created 0.1s
✔ Container otel-collector Started 0.1s
✔ Container mysqld-exporter Started