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 天前
如何用命令行把win10/win11设置为长期暂停更新?
linux·windows·经验分享·电脑
Factory_Audit4 天前
亚马逊社会责任验厂审核标准及注意事项
大数据·经验分享
江南小书生4 天前
制造业系统赋能成熟度自测表(实操版)
经验分享·非标制造
三流架构师4 天前
述职报告资源合集
经验分享
徐先生 @_@|||5 天前
时间序列异常检测框架CrossAD论文阅读
经验分享·python·机器学习
LaughingZhu5 天前
Product Hunt 每日热榜 | 2026-02-25
数据库·人工智能·经验分享·神经网络·chatgpt
中屹指纹浏览器5 天前
2026 硬核技术实践:浏览器指纹生成算法与风控逆向对抗
经验分享·笔记
给老吕螺丝5 天前
提升国内访问GitHub稳定性的解决方案:Steamcommunity 302工具详解 (Ver.13.0.05+)
经验分享·github
智者知已应修善业5 天前
【查找指定字符串首位置与数量不区分大小写完整匹配】2025-5-3
c语言·c++·经验分享·笔记·算法
三水不滴5 天前
利用SpringCloud Gateway 重试 + 降级解决第三方接口频繁超时问题,提升性能
经验分享·笔记·后端·spring·spring cloud·gateway