Skywalking运维之路(exporter状态监控)

Skywalking对主机,数据库等系统状态提供了全面的监控,这里来演示下如何进行接入,仅做参考!

1. 监控主机状态

1.1 部署Prometheus node-exporter

bash 复制代码
# 请自行部署

1.2 安装OpenTelemetry Collector

1.2.1 创建文件夹

bash 复制代码
root@ubuntu2204test99:~# mkdir -p OpenTelemetryCollector/config

1.2.2 编写docker-compose

bash 复制代码
root@ubuntu2204test99:~/OpenTelemetryCollector# cat docker-compose.yml
services:
  otel-collector:
    image: otel/opentelemetry-collector-contrib:0.50.0
    command: [ "--config=/etc/otel-collector-config.yaml" ]
    volumes:
      #- ./config/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
      - ./config/otel-collector-config.yaml:/etc/otel-collector-config.yaml
    ports:
      #- 1888:1888 # pprof extension
      #- 28888:8888 # Prometheus metrics exposed by the Collector
      #- 28889:8889 # Prometheus exporter metrics
      #- 13133:13133 # health_check extension
      #- 4317:4317 # OTLP gRPC receiver
      #- 4318:4318 # OTLP http receiver
      - 55678:55678 # zpages extension

1.2.3 修改配置文件

bash 复制代码
root@ubuntu2204test99:~# cat OpenTelemetryCollector/config/otel-collector-config.yaml
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: "vm-monitoring" # make sure to use this in the vm.yaml to filter only VM metrics
          scrape_interval: 10s
          static_configs:
            - targets: ["192.168.1.98:9100"]

processors:
  batch:

exporters:
  otlp:
    endpoint: "192.168.1.99:11800" # The OAP Server address
    # The config format of OTEL version prior to 0.34.0, eg. 0.29.0, should be:
    # insecure: true
    tls:
      insecure: true
    #insecure: true
  # Exports data to the console
  logging:
    loglevel: debug

service:
  pipelines:
    metrics:
      receivers: [prometheus]
      processors: [batch]
      exporters: [otlp, logging]

2. 监控mysql状态

2.1 部署mysql-exporter

bash 复制代码
# 请自行部署

2.2 修改OpenTelemetry配置

bash 复制代码
root@ubuntu2204test99:~# cat OpenTelemetryCollector/config/otel-collector-config.yaml
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: "vm-monitoring" # make sure to use this in the vm.yaml to filter only VM metrics
          scrape_interval: 10s
          static_configs:
            - targets: ["192.168.1.98:9100"]
        # 监控Mysql示例
        - job_name: "My-DB-Serv" #注意这个名称
          scrape_interval: 5s
          static_configs:
           - targets: ["192.168.1.43:9105"]
             labels:  #标签会影响在Skywalking中显示的名字
               #host_name: root[root]
               host_name: My-DB[192.168.1.43]

processors:
  batch:

exporters:
  otlp:
    endpoint: "192.168.1.99:11800" # The OAP Server address
    # The config format of OTEL version prior to 0.34.0, eg. 0.29.0, should be:
    # insecure: true
    tls:
      insecure: true
    #insecure: true
  # Exports data to the console
  logging:
    loglevel: debug

service:
  pipelines:
    metrics:
      receivers: [prometheus]
      processors: [batch]
      exporters: [otlp, logging]

2.3 修改Skywalking中mysql的相关配置

bash 复制代码
root@ubuntu2204test99:~/skywailking# vi skywalking-oap/config/otel-rules/mysql/mysql-instance.yaml
#filter: "{ tags -> tags.job_name == 'mysql-monitoring' }" # The OpenTelemetry job name
filter: "{ tags -> tags.job_name == 'HK-DB-Serv' }" # 要和otlp配置的job_name匹配
.........
root@ubuntu2204test99:~/skywailking# vi skywalking-oap/config/otel-rules/mysql/mysql-service.yaml
#filter: "{ tags -> tags.job_name == 'mysql-monitoring' }" # The OpenTelemetry job name
filter: "{ tags -> tags.job_name == 'HK-DB-Serv' }" # 要和otlp配置的job_name匹配
.........
相关推荐
无奈笑天下4 小时前
【银河麒麟高级服务器部署本地yum源】
linux·运维·服务器·经验分享
浓墨染彩霞4 小时前
Java-----多线路
java·经验分享·笔记
浩瀚地学5 小时前
【Java】String
java·开发语言·经验分享·笔记·学习
掘金安东尼5 小时前
Next.js、Nuxt.js、Vite 与 Bun:现代前端工具链全景解析
经验分享
LaughingZhu5 小时前
Product Hunt 每日热榜 | 2025-12-01
大数据·人工智能·经验分享·搜索引擎·产品运营
edtoplort5 小时前
独角兽陨落,从独立方案商的困境看自动驾驶的未来走向
经验分享
金海境科技6 小时前
数据安全保险迎来爆发期 2025年市场规模将突破50亿元 - 金海境科技
经验分享
以梦为马mmky6 小时前
华东交通大学上岸经验分享
经验分享·通信考研·信号与系统·华东交通大学
YIN_尹7 小时前
openEuler 上 CUDA 与 ROCm 的 GPU 加速实战
经验分享
浩瀚地学8 小时前
【Java】ArrayList
java·开发语言·经验分享·笔记