> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/s/sonarqube-self-hosted.md).

# Sonarqube Self Hosted

SonarQube is a self-hosted code quality and security analysis platform. OctoXLabs reads the projects, with their branches, pull requests, open issues, members and language mix, and adds them to the source code inventory.

## Use cases

* **List projects tracked in SonarQube.** Review the source code assets from this adapter.

```
Adapters = sonarqube-self-hosted
```

* **Review projects by open issue count or main language.** Use the open issue count and primary language fields in the source code inventory to find projects that need attention.

## Before you begin

### Network

| Source              | Destination                   | Port                  | Protocol                         |
| ------------------- | ----------------------------- | --------------------- | -------------------------------- |
| OctoXLabs connector | SonarQube host (IP parameter) | 9000 (Port parameter) | HTTPS (HTTP if Is Secure is off) |

The connector does not verify the TLS certificate.

### Required permissions

| Scope or role               | Permission                                | Needed for                                                               |
| --------------------------- | ----------------------------------------- | ------------------------------------------------------------------------ |
| Account that owns the token | Read-only access to the projects to fetch | Projects, branches, pull requests, issues, measures, project permissions |

## Create credentials in SonarQube

{% stepper %}
{% step %}

### Open your account

Sign in to SonarQube, click the avatar at the top right and open **My Account**.
{% endstep %}

{% step %}

### Open the security tab

Go to **Security** and the **Tokens** section.
{% endstep %}

{% step %}

### Generate a token

Generate a token with a name, then copy it. The token must belong to an account with read-only access to the projects to fetch.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter    | Required | Type    | Default | Description                                                                                            |
| ------------ | -------- | ------- | ------- | ------------------------------------------------------------------------------------------------------ |
| IP           | Yes      | String  | None    | IP address or hostname of the SonarQube host.                                                          |
| Port         | No       | Integer | 9000    | Port of the host.                                                                                      |
| API Token    | Yes      | String  | None    | SonarQube token.                                                                                       |
| Is Secure    | No       | Boolean | True    | Use HTTPS.                                                                                             |
| Thread Count | No       | Integer | 32      | Parallel threads. Minimum 1, maximum 32.                                                               |
| Sleep Time   | No       | Integer | 0       | Seconds to wait while threads are started. A higher value lowers resource use but lengthens discovery. |

## Troubleshooting

| Error message                                                  | Cause                                                                                   | Fix                                                            |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| Status Code: `, followed by URL, Method and the response body` | The API answered with a status other than 200. This is the shared REST connector error. | Check the token, the account permissions, the IP and the port. |

## Change history
