---
title: SonarQube
description: Monitor your SonarQube server and projects.
breadcrumbs: Docs > Integrations > SonarQube
---

# SonarQube
Supported OS Integration version5.6.1
## Overview{% #overview %}

This check monitors [SonarQube](https://www.sonarqube.org).

**Minimum Agent version:** 7.24.0

## Setup{% #setup %}

### Installation{% #installation %}

The SonarQube check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package. No additional installation is needed on your server.

### Configuration{% #configuration %}

SonarQube exposes metrics from two sources: its web API and JMX. To collect all of the metrics specified below, configure three instances of this check. One to monitor SonarQube's web API, and the other two to monitor SonarQube's JMX beans.

Documentation on SonarQube's web API is available at `/web_api` on your SonarQube web UI. By default this integration collects all relevant SonarQube performance metrics exposed through SonarQube's JMX beans. The configuration for these default metrics is available in the [sonarqube.d/metrics.yaml](https://github.com/DataDog/integrations-core/blob/master/sonarqube/datadog_checks/sonarqube/data/metrics.yaml) file. Documentation on these beans is available on [SonarQube's website](https://docs.sonarqube.org/latest/server-upgrade-and-maintenance/monitoring/instance/#exposed-jmx-mbeans).

SonarQube's JMX server is **not enabled** by default, this means that unless it is enabled, `sonarqube.server.*` metrics are not collected. More information on how to enable and configure JMX within SonarQube is available within the [SonarQube documentation](https://docs.sonarsource.com/sonarqube/latest/instance-administration/monitoring/instance/#how-do-i-activate-jmx). Below are configurations needed to enable the JMX server for some common Java processes:

```
# WEB SERVER
sonar.web.javaAdditionalOpts="
  -Dcom.sun.management.jmxremote=true
  -Dcom.sun.management.jmxremote.port=10443
  -Dcom.sun.management.jmxremote.rmi.port=10443
  ...
  "

# COMPUTE ENGINE
sonar.ce.javaAdditionalOpts="
  -Dcom.sun.management.jmxremote=true
  -Dcom.sun.management.jmxremote.port=10444
  -Dcom.sun.management.jmxremote.rmi.port=10444
  ...
  "

# ELASTICSEARCH
sonar.search.javaAdditionalOpts="
  -Dcom.sun.management.jmxremote=true
  -Dcom.sun.management.jmxremote.port=10445
  -Dcom.sun.management.jmxremote.rmi.port=10445
  ...
  "
```

This is a basic `sonarqube.d/conf.yaml` example based on SonarQube and JMX defaults. You can use it as a starting point when configuring for both the host-based or container-based Agent installation.

```yaml
init_config:
    is_jmx: false
    collect_default_metrics: true
instances:

  # Web API instance
  - is_jmx: false
    web_endpoint: http://localhost:9000
    auth_type: basic
    username: <username>    # Defined in the Web UI
    password: <password>    # Defined in the Web UI
    default_tag: component  # Optional
    components:             # Required
      my-project:
        tag: project_name

  # Web JMX instance
  - is_jmx: true
    host: localhost
    port: 10443           # See sonar.web.javaAdditionalOpts in SonarQube's sonar.properties file
    user: <username>      # Defined in SonarQube's sonar.properties file
    password: <password>  # Defined in SonarQube's sonar.properties file

  # Compute Engine JMX instance
  - is_jmx: true
    host: localhost
    port: 10444           # See sonar.ce.javaAdditionalOpts in SonarQube's sonar.properties file
    user: <username>      # Defined in SonarQube's sonar.properties file
    password: <password>  # Defined in SonarQube's sonar.properties file
```

**Note**: Once the integration is configured, have SonarQube scan at least one project to send metrics to Datadog.

Metrics collected by this integration are tagged with a `component` tag by default. If you wish to change the tag name on a per component basis, specify the `tag` property within the component definition. To set it for all projects, set the `default_tag` property on the instance config.

**Note**: Projects in SonarQube often contain multiple source control branches. This integration can only collect metrics from the default branch in SonarQube (typically `main`).

#### Search server metrics{% #search-server-metrics %}

SonarQube exposes a search server, which can be monitored using an additional instance of this integration and a configuration of the JMX metrics. To learn how to customize the metrics to collect, see the [JMX Checks documentation](https://docs.datadoghq.com/integrations/java.md) for more detailed instructions. For an example, use the config below and default JMX metric config in [sonarqube.d/metrics.yaml](https://github.com/DataDog/integrations-core/blob/master/sonarqube/datadog_checks/sonarqube/data/metrics.yaml).

```yaml
init_config:
  # The list of metrics to be collected by the integration.
  config:
    - include:
      domain: SonarQube
      name: <name>
      exclude_tags:
        - name
      attribute:
        MyMetric:
          alias: sonarqube.search_server.my_metric
          metric_type: gauge
instances:
  # Search Server JMX instance
  - is_jmx: true
    host: localhost
    port: 10445           # See sonar.search.javaAdditionalOpts in SonarQube's sonar.properties file
    user: <username>      # Defined in SonarQube's sonar.properties file
    password: <password>  # Defined in SonarQube's sonar.properties file
```

{% tab title="Host" %}
#### Host{% #host %}

To configure this check for an Agent running on a host:

##### Metric collection{% #metric-collection %}

1. Edit the `sonarqube.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your SonarQube data. See the [sample sonarqube.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/sonarqube/datadog_checks/sonarqube/data/conf.yaml.example) for all available configuration options.

This check has a limit of 350 metrics per JMX instance. The number of returned metrics is indicated in [the status page](https://docs.datadoghq.com/agent/guide/agent-commands.md#agent-status-and-information). You can specify the metrics you are interested in by editing the configuration below. To learn how to customize the metrics to collect, see the [JMX Checks documentation](https://docs.datadoghq.com/integrations/java.md) for more detailed instructions. If you need to monitor more metrics, contact [Datadog support](https://docs.datadoghq.com/help/).

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands.md#start-stop-and-restart-the-agent).

##### Log collection{% #log-collection %}

1. Enable SonarQube [logging](https://docs.sonarqube.org/latest/instance-administration/system-info/).

1. Collecting logs is disabled by default in the Datadog Agent. Enable it in your `datadog.yaml` file:

   ```yaml
   logs_enabled: true
   ```

1. Add the following configuration block to your `sonarqube.d/conf.yaml` file. Change the `path` and `service` parameter values based on your environment. See the [sample sonarqube.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/sonarqube/datadog_checks/sonarqube/data/conf.yaml.example) for all available configuration options.

   ```yaml
   logs:
     - type: file
       path: /opt/sonarqube/logs/access.log
       source: sonarqube
     - type: file
       path: /opt/sonarqube/logs/ce.log
       source: sonarqube
       log_processing_rules:
         - type: multi_line
           name: log_start_with_date
           pattern: \d{4}\.\d{2}\.\d{2}
     - type: file
       path: /opt/sonarqube/logs/es.log
       source: sonarqube
       log_processing_rules:
         - type: multi_line
           name: log_start_with_date
           pattern: \d{4}\.\d{2}\.\d{2}
     - type: file
       path: /opt/sonarqube/logs/sonar.log
       source: sonarqube
       log_processing_rules:
         - type: multi_line
           name: log_start_with_date
           pattern: \d{4}\.\d{2}\.\d{2}
     - type: file
       path: /opt/sonarqube/logs/web.log
       source: sonarqube
       log_processing_rules:
         - type: multi_line
           name: log_start_with_date
           pattern: \d{4}\.\d{2}\.\d{2}
   ```

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands.md#start-stop-and-restart-the-agent).

{% /tab %}

{% tab title="Containerized" %}
#### Containerized{% #containerized %}

##### Metric collection{% #metric-collection %}

For containerized environments, see the [Autodiscovery with JMX](https://docs.datadoghq.com/agent/guide/autodiscovery-with-jmx.md?tab=containerizedagent) guide.

##### Log collection{% #log-collection %}

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [Docker log collection](https://docs.datadoghq.com/agent/docker/log.md).

| Parameter      | Value                     |
| -------------- | ------------------------- |
| `<LOG_CONFIG>` | `{"source": "sonarqube"}` |

{% /tab %}

#### Components Discovery{% #components-discovery %}

You can configure how your components are discovered with the `components_discovery` parameter.

{% dl %}

{% dt %}
`limit`
{% /dt %}

{% dd %}
Maximum number of items to be autodiscovered.**Default value**: `10`
{% /dd %}

{% dt %}
`include`
{% /dt %}

{% dd %}
Mapping of regular expression keys and component config values to autodiscover.**Default value**: empty map
{% /dd %}

{% dt %}
`exclude`
{% /dt %}

{% dd %}
List of regular expressions with the patterns of components to exclude from autodiscovery.**Default value**: empty list
{% /dd %}

{% /dl %}

**Examples**:

Include a maximum of `5` components with names starting with `my_project`:

```yaml
components_discovery:
  limit: 5
  include:
    'my_project*':
```

Include a maximum of `20` components and exclude those beginning with `temp`:

```yaml
components_discovery:
  limit: 20
  include:
    '.*':
  exclude:
    - 'temp*'
```

Include all components with names starting with `issues`, apply the `issues_project` tag, and only collect metrics belonging to the category `issues`. As `limit` is not defined, the number of components discovered is limited to the default value `10`:

```yaml
components_discovery:
  include:
    'issues*':
       tag: issues_project
       include:
         - issues.
```

### Validation{% #validation %}

[Run the Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands.md#agent-status-and-information) and look for `sonarqube` under the **JMXFetch** section:

```text
========
JMXFetch
========
  Initialized checks
  ==================
    sonarqube
      instance_name : sonarqube-localhost-10444
      message : <no value>
      metric_count : 33
      service_check_count : 0
      status : OK
      instance_name : sonarqube-localhost-10443
      message : <no value>
      metric_count : 38
      service_check_count : 0
      status : OK
```

If you set an instance without `is_jmx: true`, also look for `sonarqube` under the **Collector** section:

```text
=========
Collector
=========
  Running Checks
  ==============
    sonarqube (1.1.0)
    -----------------
      Instance ID: sonarqube:1249c1ed7c7b489a [OK]
      Configuration Source: file:/etc/datadog-agent/conf.d/sonarqube.d/conf.yaml
      Total Runs: 51
      Metric Samples: Last Run: 39, Total: 1,989
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 1, Total: 51
      Average Execution Time : 1.19s
      Last Execution Date : 2021-03-12 00:00:44.000000 UTC
      Last Successful Execution Date : 2021-03-12 00:00:44.000000 UTC
```

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **sonarqube.complexity.cognitive\_complexity**(gauge)                          | Cognitive complexity                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **sonarqube.complexity.complexity**(gauge)                                     | Cyclomatic complexity                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.coverage.branch\_coverage**(gauge)                                 | Condition coverage*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                                                  |
| **sonarqube.coverage.conditions\_to\_cover**(gauge)                            | Conditions to cover                                                                                                                                                                                                                                                                                                                                                                                                                   |
| **sonarqube.coverage.coverage**(gauge)                                         | Coverage by tests*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                                                   |
| **sonarqube.coverage.line\_coverage**(gauge)                                   | Line coverage*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.coverage.lines\_to\_cover**(gauge)                                 | Lines to cover                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **sonarqube.coverage.new\_branch\_coverage**(gauge)                            | Condition coverage of new/changed code*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                              |
| **sonarqube.coverage.new\_conditions\_to\_cover**(gauge)                       | Conditions to cover on new code                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.coverage.new\_coverage**(gauge)                                    | Coverage of new/changed code*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                                        |
| **sonarqube.coverage.new\_line\_coverage**(gauge)                              | Line coverage of added/changed code*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.coverage.new\_lines\_to\_cover**(gauge)                            | Lines to cover on new code                                                                                                                                                                                                                                                                                                                                                                                                            |
| **sonarqube.coverage.new\_uncovered\_conditions**(gauge)                       | Uncovered conditions on new code                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.coverage.new\_uncovered\_lines**(gauge)                            | Uncovered lines on new code                                                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.coverage.skipped\_tests**(gauge)                                   | Number of skipped unit tests                                                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.coverage.test\_errors**(gauge)                                     | Number of unit test errors                                                                                                                                                                                                                                                                                                                                                                                                            |
| **sonarqube.coverage.test\_failures**(gauge)                                   | Number of unit test failures                                                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.coverage.test\_success\_density**(gauge)                           | Density of successful unit tests*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.coverage.tests**(gauge)                                            | Number of unit tests                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **sonarqube.coverage.uncovered\_conditions**(gauge)                            | Uncovered conditions                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **sonarqube.coverage.uncovered\_lines**(gauge)                                 | Uncovered lines                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.duplications.duplicated\_blocks**(gauge)                           | Duplicated blocks                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **sonarqube.duplications.duplicated\_files**(gauge)                            | Duplicated files                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.duplications.duplicated\_lines**(gauge)                            | Duplicated lines                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.duplications.duplicated\_lines\_density**(gauge)                   | Duplicated lines balanced by statements*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                             |
| **sonarqube.duplications.new\_duplicated\_blocks**(gauge)                      | Duplicated blocks on new code                                                                                                                                                                                                                                                                                                                                                                                                         |
| **sonarqube.duplications.new\_duplicated\_lines**(gauge)                       | Duplicated Lines on New Code                                                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.duplications.new\_duplicated\_lines\_density**(gauge)              | Duplicated lines (%) on new code balanced by statements*Shown as percent*                                                                                                                                                                                                                                                                                                                                                             |
| **sonarqube.issues.blocker\_violations**(gauge)                                | Blocker issues                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **sonarqube.issues.confirmed\_issues**(gauge)                                  | Confirmed issues                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.issues.critical\_violations**(gauge)                               | Critical issues                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.issues.false\_positive\_issues**(gauge)                            | False positive issues                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.issues.info\_violations**(gauge)                                   | Info issues                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.issues.major\_violations**(gauge)                                  | Major issues                                                                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.issues.minor\_violations**(gauge)                                  | Minor issues                                                                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.issues.new\_blocker\_violations**(gauge)                           | New Blocker issues                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.issues.new\_critical\_violations**(gauge)                          | New Critical issues                                                                                                                                                                                                                                                                                                                                                                                                                   |
| **sonarqube.issues.new\_info\_violations**(gauge)                              | New Info issues                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.issues.new\_major\_violations**(gauge)                             | New Major issues                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.issues.new\_minor\_violations**(gauge)                             | New Minor issues                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.issues.new\_violations**(gauge)                                    | New issues                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **sonarqube.issues.open\_issues**(gauge)                                       | Open issues                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.issues.reopened\_issues**(gauge)                                   | Reopened issues                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.issues.violations**(gauge)                                         | Issues                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.issues.wont\_fix\_issues**(gauge)                                  | Won't fix issues                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **sonarqube.maintainability.code\_smells**(gauge)                              | Code Smells                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.maintainability.new\_code\_smells**(gauge)                         | New Code Smells                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.maintainability.new\_maintainability\_rating**(gauge)              | Maintainability rating on new code                                                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.maintainability.new\_sqale\_debt\_ratio**(gauge)                   | Technical Debt Ratio of new/changed code.*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.maintainability.sqale\_debt\_ratio**(gauge)                        | Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch*Shown as percent*                                                                                                                                                                                                                                                                                                     |
| **sonarqube.maintainability.sqale\_rating**(gauge)                             | A-to-E rating based on the technical debt ratio                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.reliability.bugs**(gauge)                                          | Bugs                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **sonarqube.reliability.new\_bugs**(gauge)                                     | New Bugs                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **sonarqube.reliability.new\_reliability\_rating**(gauge)                      | Reliability rating on new code                                                                                                                                                                                                                                                                                                                                                                                                        |
| **sonarqube.reliability.reliability\_rating**(gauge)                           | Reliability rating                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.security.new\_security\_rating**(gauge)                            | Security rating on new code                                                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.security.new\_vulnerabilities**(gauge)                             | New Vulnerabilities                                                                                                                                                                                                                                                                                                                                                                                                                   |
| **sonarqube.security.security\_rating**(gauge)                                 | Security rating                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.security.vulnerabilities**(gauge)                                  | Vulnerabilities                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.security\_review.new\_security\_hotspots**(gauge)                  | New Security Hotspots                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.security\_review.new\_security\_hotspots\_reviewed**(gauge)        | Percentage of Security Hotspots Reviewed on New Code*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.security\_review.new\_security\_review\_rating**(gauge)            | Security Review Rating on New Code                                                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.security\_review.security\_hotspots**(gauge)                       | Security Hotspots                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **sonarqube.security\_review.security\_hotspots\_reviewed**(gauge)             | Percentage of Security Hotspots Reviewed*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                            |
| **sonarqube.security\_review.security\_review\_rating**(gauge)                 | Security Review Rating                                                                                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.server.async\_execution.largest\_worker\_count**(gauge)            |
| **sonarqube.server.async\_execution.queue\_size**(gauge)                       |
| **sonarqube.server.async\_execution.worker\_count**(gauge)                     |
| **sonarqube.server.compute\_engine\_tasks.error\_count**(count)                | Number of Background Tasks which failed since the last restart of SonarQube*Shown as error*                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.server.compute\_engine\_tasks.in\_progress\_count**(gauge)         | Number of Background Tasks currently under processing. Its value is either 1 or 0, since SonarQube can process only one task at a time.                                                                                                                                                                                                                                                                                               |
| **sonarqube.server.compute\_engine\_tasks.longest\_pending\_time**(gauge)      | Pending time (ms) of the oldest Background Task waiting to be processed. This measure, together with PendingCount, helps you know if analyses are stacking and taking too long to start processing. This helps you evaluate if it might be worth configuring additional Compute Engine workers (Enterprise Edition) or additional nodes (Data Center Edition) to improve performance. Requires SonarQube >=9.0.*Shown as millisecond* |
| **sonarqube.server.compute\_engine\_tasks.pending\_count**(count)              | Number of Background Tasks waiting to be processed since the last restart of SonarQube                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.server.compute\_engine\_tasks.processing\_time**(gauge)            | Measure the time spent to process Background Tasks since the last restart. The value will always increase. This measure is powerful when combined with SuccessCount and ErrorCount measures to get the average time to handle a Background Task, or when used to understand how much time the server is spending during a day to handle Background Tasks. It gives you an indication of the load on your server.                      |
| **sonarqube.server.compute\_engine\_tasks.success\_count**(count)              | Number of Background Tasks successfully processed since the last restart of SonarQube                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.server.compute\_engine\_tasks.worker\_count**(gauge)               | Number of Background Tasks that can be processed at the same time                                                                                                                                                                                                                                                                                                                                                                     |
| **sonarqube.server.compute\_engine\_tasks.worker\_max\_count**(gauge)          |
| **sonarqube.server.database.pool\_active\_connections**(gauge)                 | Number of active database connections*Shown as connection*                                                                                                                                                                                                                                                                                                                                                                            |
| **sonarqube.server.database.pool\_idle\_connections**(gauge)                   | Number of database connections waiting to be used*Shown as connection*                                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.server.database.pool\_initial\_size**(gauge)                       | Initial size of the database connections pool*Shown as connection*                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.server.database.pool\_max\_active\_connections**(gauge)            | Maximum number of active database connections*Shown as connection*                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.server.database.pool\_max\_idle\_connections**(gauge)              | Maximum number of database connections waiting to be used*Shown as connection*                                                                                                                                                                                                                                                                                                                                                        |
| **sonarqube.server.database.pool\_max\_wait\_millis**(gauge)                   | *Shown as millisecond*                                                                                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.server.database.pool\_min\_idle\_connections**(gauge)              | *Shown as connection*                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.server.database.pool\_remove\_abandoned\_timeout\_seconds**(gauge) | *Shown as second*                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **sonarqube.size.classes**(gauge)                                              | Classes                                                                                                                                                                                                                                                                                                                                                                                                                               |
| **sonarqube.size.comment\_lines**(gauge)                                       | Number of comment lines                                                                                                                                                                                                                                                                                                                                                                                                               |
| **sonarqube.size.comment\_lines\_density**(gauge)                              | Comments balanced by ncloc + comment lines*Shown as percent*                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.size.directories**(gauge)                                          | Directories                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **sonarqube.size.files**(gauge)                                                | Number of files                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **sonarqube.size.functions**(gauge)                                            | Functions                                                                                                                                                                                                                                                                                                                                                                                                                             |
| **sonarqube.size.generated\_lines**(gauge)                                     | Number of generated lines                                                                                                                                                                                                                                                                                                                                                                                                             |
| **sonarqube.size.generated\_ncloc**(gauge)                                     | Generated non Commenting Lines of Code                                                                                                                                                                                                                                                                                                                                                                                                |
| **sonarqube.size.lines**(gauge)                                                | Lines                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **sonarqube.size.ncloc**(gauge)                                                | Non commenting lines of code                                                                                                                                                                                                                                                                                                                                                                                                          |
| **sonarqube.size.new\_lines**(gauge)                                           | New lines                                                                                                                                                                                                                                                                                                                                                                                                                             |
| **sonarqube.size.projects**(gauge)                                             | Number of projects                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **sonarqube.size.statements**(gauge)                                           | Number of statements                                                                                                                                                                                                                                                                                                                                                                                                                  |

### Events{% #events %}

SonarQube does not include any events.

### Service Checks{% #service-checks %}

**sonarqube.can\_connect**

Returns `CRITICAL` if the Agent is unable to connect to and collect metrics from the monitored SonarQube instance's JMX endpoint, `WARNING` if no metrics are collected, and `OK` otherwise.

*Statuses: ok, critical, warning*

**sonarqube.api\_access**

Returns `CRITICAL` if the Agent is unable to connect to and collect metrics from the monitored SonarQube instance's web endpoint, otherwise returns `OK`.

*Statuses: ok, critical*

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
