Skip to content

sachsgit/sonarqube-exporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SonarQube metrics exporter to InfluxDB

Simple script that ships all project metrics from SonarQube to InfluxDB.

This can be later graph with (Grafana)[https://grafana.com/]

Requirements

  • Python >= 3
  • InfluxDB python module
  • Python Requests

Python requirements can be installed with pip

pip install -r requirements.txt

Usage

Secrets such as users and passwords are handled via environment variables for simplicity.

Required ones are:

USER = os.environ['SONAR_USER']
PASSWORD = os.environ['SONAR_PASSWORD']
INFLUX_USER = os.environ['INFLUX_USER']
INFLUX_PASSWORD = os.environ['INFLUX_PASSWORD']
INFLUX_DB = os.environ['INFLUX_DB']

You can simply execute it like:

$ SONAR_USER=user SONAR_PASSWORD=passwd INFLUX_USER=user INFLUX_PASSWORD=passwd INFLUX_DB=db python sonar-client.py

This will export all the metrics in the following json

[
    {
        "fields": {
            "value": "75"
        },
        "measurement": "coverage",
        "tags": {
            "id": "somekey",
            "key": "org.sonarqube:example-generic-coverage-sonar-scanner"
        },
        "time": "2017-05-17T13:02:43.597894"
    }
]

Author: Pedro Diaz [email protected]

About

Export sonarQube metrics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.7%
  • Dockerfile 5.3%