https://github.com/dodevops/sonarqube-usertoken-exporter
A prometheus exporter that exports currently issued user tokens of a Sonarqube instance and when they expire
https://github.com/dodevops/sonarqube-usertoken-exporter
prometheus-exporter sonarqube
Last synced: 5 months ago
JSON representation
A prometheus exporter that exports currently issued user tokens of a Sonarqube instance and when they expire
- Host: GitHub
- URL: https://github.com/dodevops/sonarqube-usertoken-exporter
- Owner: dodevops
- License: mit
- Created: 2025-07-04T08:32:47.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-08-01T10:45:20.000Z (11 months ago)
- Last Synced: 2026-01-26T12:20:37.103Z (5 months ago)
- Topics: prometheus-exporter, sonarqube
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Sonarqube usertoken exporter
A prometheus exporter that exports currently issued user tokens of a Sonarqube instance
and when they expire.
## Usage
Start the container (e.g. using podman or docker) to launch the exporter locally.
podman run --rm -p 8081:8081 -e EXPORTER_URL=https://sonarqube.company.com -e EXPORTER_TOKEN=verysecretadmintoken ghcr.io/dodevops/sonarqube-usertoken-exporter:latest
After that, the metrics can be retrieved using http://localhost:8081/metrics
The following environment variables are required to configure the exporter:
* EXPORTER_URL: URL to the sonarqube instance
* EXPORTER_TOKEN: A user token with admin privileges
And these are optional for further configuration:
* EXPORTER_LOGLEVEL: Level to use when logging out information [INFO]
* EXPORTER_PORT: Port to listen on [8081]
* EXPORTER_INTERVAL: Interval to sleep between metric gathering in minutes [60]
## Metrics
The following metrics are exporter:
### sonarqube_user_tokens_expiration_date_seconds
The expiration of a user token as a unix epoch.
The following labels are provided:
* user: The username that the token is bound to
* token: Name of the token
* type: User token type. Can be USER_TOKEN, GLOBAL_ANALYSIS_TOKEN or PROJECT_ANALYSIS_TOKEN
* project_key: Assigned project key if the key is of the PROJECT_ANALYSIS_TOKEN type
* is_expired: A boolean "true"/"false" whether the user token has expired
### sonarqube_user_tokens_creation_date_seconds
The creation date of a user token as a unix epoch
The following labels are provided:
* user: The username that the token is bound to
* token: Name of the token
* type: User token type. Can be USER_TOKEN, GLOBAL_ANALYSIS_TOKEN or PROJECT_ANALYSIS_TOKEN
* project_key: Assigned project key if the key is of the PROJECT_ANALYSIS_TOKEN type
* is_expired: A boolean "true"/"false" whether the user token has expired