HEL! How to scrape metrics from SonarQube

607 views
Skip to first unread message

Nguyen Viet

unread,
Feb 2, 2021, 3:12:48 PM2/2/21
to Prometheus Users

Hi,

I am trying to configure Prometheus to scrape metrics from SonarQube Community version.

The metrics are now exposed to https://sonarlink/api/prometheus/metrics

My SonarQube is authenticated with SSO to Microsoft AD. I have tried different authentication methods from basic user/pass, token but it does not work. It returns “server returned HTTP status 401”

- job_name: sonarqube
  metrics_path: /api/prometheus/metrics
  scrape_interval: 30s
  scrape_timeout: 28s
  scheme: https
  static_configs:
    - targets: [‘SOARQUBE.abc.com’]
  tls_config:
    insecure_skip_verify: true
  basic_auth:
    username: “acc...@email.com
    password: “password”
OR

  params:
    bearer_token: [‘TOKENID’]

Thank you for any suggestion!

Nguyen Viet

unread,
Feb 2, 2021, 4:03:16 PM2/2/21
to Prometheus Users
Found the resolution from this document: https://docs.sonarqube.org/latest/extend/web-api/

So, basic_auth with username is the token and password is NULL - such as weird approach from Sonar...

Reply all
Reply to author
Forward
0 new messages