1. Enable Prometheus telemetry data

By default, Telemetry is turned off (selector none), like this:

telemetry:
  selector: ${SW_TELEMETRY:none}
  none:
  prometheus:
    host: The ${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:""}
Copy the code

Prometheus may serve as the telemetry implementer. Using this feature, Prometheus could collect metrics data for Skywalking OAP.

Edit the config/application.yml file and set selector to Prometheus like this:

telemetry:
  selector: ${SW_TELEMETRY:prometheus}
  none:
  prometheus:
    host: The ${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:""}
Copy the code

By default, the endpoint in the open in http://0.0.0.0:1234/ and http://0.0.0.0:1234/metrics. You can also set the host and port as required.

2. Start Prometheus Fetcher

SkyWalking supports the collection of Prometheus telemetry data directly into the OAP background. Users can view them through the UI or the GraphQL API.

By default, Prometheus Fetcher is off (active is false), like this:

prometheus-fetcher:
  selector: ${SW_PROMETHEUS_FETCHER:default}
  default:
    active: ${SW_PROMETHEUS_FETCHER_ACTIVE:false}
Copy the code

Edit the config/application.yml file and set active to true, like this:

prometheus-fetcher:
  selector: ${SW_PROMETHEUS_FETCHER:default}
  default:
    active: ${SW_PROMETHEUS_FETCHER_ACTIVE:true}
Copy the code

3. View the self-monitoring data

Restart the OAP for the modified configuration file to take effect.

Select SelfObservability in UI, and then select OAP-Server in the service list. The result is as follows:

Note: This article uses SkyWalking version 8.2.0 as an example. There may be some differences between different versions.