Coder Social home page Coder Social logo

sonarqube-prometheus-exporter's Introduction

Sonarqube Prometheus Exporter

Prometheus Exporter Plugin for SonarQube.

Build Status  SonarCloud Analysis Download License Semantic Versioning

InformationFeaturesRequirementsInstallationUsageScreenshots

Information

This plugin is a fork of dmeiners88 / sonarqube-prometheus-exporter, as I have seen that the repository has been stopped for a long time, I will evolve in this repository the plugin.

Features

  • Configure which metrics to export

Requirements

  • SonarQube 8.x

Installation

  1. Download latest snapshot release
  2. Drop sonar-prometheus-exporter-1.0.0-SNAPSHOT.jar into $SONARQUBE_HOME/extensions/plugins.
  3. Restart the SonarQube server.

Usage

  1. Configure which metrics you want to export under Administration → Configuration → General Settings → Prometheus Exporter
  2. Add a scrape config to your Prometheus instance similar to this:
scrape_configs:
  - job_name: 'sonarqube'
    metrics_path: '/api/prometheus/metrics'
    static_configs:
      - targets: ['localhost:9000']
  1. Alternatively, point your HTTP client to http://localhost:9000/api/prometheus/metrics

Screenshots

Configuration Page API Call Example Grafana Dashboard Example Grafana Dashboard

Local plugin testing

In order to test the plugin locally, a file has been created for docker-compose which starts the following docker programs:

  • Sonarqube 8.9-community
  • Prometheus 2.30.1
  • Grafana 8.1.5

Previous requirements

The previous steps to be able to test the plugin are the following:

  • Install docker and docker-compose, if they are not.
  • Generate the jar file, using the following command: mvn clean package
  • Make sure the volume mounted inside the docker-compose points to the correct jar filename (the one generated in the previous step).
  • Launch the following command: sudo sysctl -w vm.max_map_count = 262144, this command is necessary to start the internal Elasticsearch of Sonarqube.

Test execution

To run the test, you must enter the docker folder and execute the following command: docker-compose up -d or docker compose up -d, depending on the docker-compose installation performed.

To stop the test, you must enter the docker folder and execute the following command: docker-compose down or docker compose down, depending on the docker-compose installation performed.

Access to the applications is as follows:

In order to view data from Sonarqube, you can add the current project, using the command mvn sonar: sonar -Dsonar.host.url = http: // localhost: 9000 -Dsonar.login = <sonarqube user token>, it is recommended launch it at least 2 times, in this way all the data can be displayed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.