Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this exporter cmpatible with sonarQube 9.X..? #22

Open
eliassal opened this issue Sep 23, 2022 · 4 comments
Open

Is this exporter cmpatible with sonarQube 9.X..? #22

eliassal opened this issue Sep 23, 2022 · 4 comments

Comments

@eliassal
Copy link

eliassal commented Sep 23, 2022

Hi, I followed instructions, after dropping the jar, restarting sonar, I can see "Prom exporter " in the general settings of sonarqube.
My Prometheus is on another linux machine and listens on port 9090 and I entered the following in prometheus.yaml

job_name: 'sonarqube'
metrics_path: '/api/prometheus/metrics'
static_configs:
- targets: ['mysonarVM:9000']

When I visit
http://mysonarVM:9000/api/prometheus/metrics

I get a blank page, nothing is displayed

Visiting my prometheus main page > Status > Targets, it is always in "down" status and

Endpoint State Labels Last Scrape Scrape Duration Error
http://mysonarVM9000/api/prometheus/metrics DOWN
instance="mysonarVM:9000"job="sonarqube"

**server returned HTTP status 401** 

When I try the url
http://myprometheus:9090/api/prometheus/metrics

I get

404 page not found

Thanks for your help

@molu8bits
Copy link

Seems that from version 9.3 SonarQube added native support for Prometheus metrics for all editions.
https://www.sonarqube.org/sonarqube-9-3/
You can find details here:
https://docs.sonarqube.org/latest/instance-administration/monitoring/
Check endpoint /api/monitoring/metrics

@eliassal
Copy link
Author

So many thanks, I visited the 2nd url you provided, in the "Prometheus monitoring" section it is indicated 3 options to authenticate but no examples. I am a little bit confused whether I should the user:password in prometheus . ymal file or where !!!
It also indicates Bearer in system.properties.... where is this file?

So my question now : how can I add user/password in prometheus .yml file? or somewhere else? Thanks again

@eliassal
Copy link
Author

Ok I managed to make it work using as 'Authorization:Bearer.... ' never worked

- job_name: 'sonarqube'
    metrics_path: '/api/monitoring/metrics'
    basic_auth:
      username: 'admin'
      password: 'mypassword'
    #bearer_token: 'sqa_44444444444.......aa565fc5f0d7'
    static_configs:
      - targets: ['mySQ:9000']

However, this integrated function is only for SQ health and not not projects KPIs as the old What I am interested in is details of analysis of each project that I can display in Grafana, something like projects against vulnerabilities/code smells when I meet the dev teams

@probeonstimpack
Copy link

I'm not sure whether the original poster needs the answer to the question in title anymore but if anyone ends up here (like i did):
Yes, this exporter is working fine on SQ 9.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants