欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

教你快速开启Apache SkyWalking的自监控

程序员文章站 2022-06-23 10:38:46
1. 开启prometheus遥测数据默认情况下, 遥测功能(telemetry)是关闭的(selector 为 none),像这样:telemetry: selector: ${sw_teleme...

1. 开启prometheus遥测数据

默认情况下, 遥测功能(telemetry)是关闭的(selectornone),像这样:

telemetry:
  selector: ${sw_telemetry:none}
  none:
  prometheus:
    host: ${sw_telemetry_prometheus_host:0.0.0.0}
    port: ${sw_telemetry_prometheus_port:1234}
    sslenabled: ${sw_telemetry_prometheus_ssl_enabled:false}
    sslkeypath: ${sw_telemetry_prometheus_ssl_key_path:""}
    sslcertchainpath: ${sw_telemetry_prometheus_ssl_cert_chain_path:""}

prometheus 可做为遥测功能(telemetry)的实现者。使用这个功能,prometheus 就可以收集 skywalking oap 的 metrics 数据。

编辑config/application.yml文件,把selector 设置为 prometheus,像这样:

telemetry:
  selector: ${sw_telemetry:prometheus}
  none:
  prometheus:
    host: ${sw_telemetry_prometheus_host:0.0.0.0}
    port: ${sw_telemetry_prometheus_port:1234}
    sslenabled: ${sw_telemetry_prometheus_ssl_enabled:false}
    sslkeypath: ${sw_telemetry_prometheus_ssl_key_path:""}
    sslcertchainpath: ${sw_telemetry_prometheus_ssl_cert_chain_path:""}

默认情况下,端点在开放在 http://0.0.0.0:1234/ 和 http://0.0.0.0:1234/metrics 。也可以根据需要设置主机和端口。

2. 开启 prometheus fetcher

skywalking 支持将 prometheus 遥测数据直接收集到 oap 后台。用户可以通过 ui 或 graphql api 查看它们。

默认情况下,prometheus fetcher是关闭的(activefalse),像这样:

prometheus-fetcher:
  selector: ${sw_prometheus_fetcher:default}
  default:
    active: ${sw_prometheus_fetcher_active:false}

编辑config/application.yml文件,把active 设置为 true,像这样:

prometheus-fetcher:
  selector: ${sw_prometheus_fetcher:default}
  default:
    active: ${sw_prometheus_fetcher_active:true}

3. 查看自监控数据

重启 oap ,让修改的配置文件生效。

在 ui 中选择 selfobservability ,然后在服务列表中选择 oap-server ,效果如下图:

教你快速开启Apache SkyWalking的自监控

注:本文以skywalking的8.2.0版本为例进行介绍,如果版本不同会略有差异。

到此这篇关于如何开启apache skywalking的自监控的文章就介绍到这了,更多相关apache skywalking开启自监控内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!