Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rrreeeyyy/prometheus-http-sd
Prometheus service discovery using with HTTP API and file_sd_config.
https://github.com/rrreeeyyy/prometheus-http-sd
prometheus prometheus-service-discovery
Last synced: 3 months ago
JSON representation
Prometheus service discovery using with HTTP API and file_sd_config.
- Host: GitHub
- URL: https://github.com/rrreeeyyy/prometheus-http-sd
- Owner: rrreeeyyy
- License: apache-2.0
- Created: 2018-06-07T20:44:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-15T01:58:33.000Z (about 3 years ago)
- Last Synced: 2024-08-02T15:48:03.164Z (6 months ago)
- Topics: prometheus, prometheus-service-discovery
- Language: Go
- Homepage:
- Size: 5.78 MB
- Stars: 23
- Watchers: 6
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Since prometheus version 2.28, Prometheus provides a generic HTTP Service discovery.
We recommend to use prometheus native http_sd feature.https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config
# prometheus-http-sd
Prometheus service discovery using with HTTP API and `file_sd_config`.
## Install
### Precompiled binaries
Download from https://github.com/rrreeeyyy/prometheus-http-sd
### Docker
```
docker pull rrreeeyyy/prometheus-http-sd
```## Usage
- Run a single API endpoint
```
./prometheus-http-sd --api.url="http://api.example.com/service_discovery.json" --output.file=/path/to/http_sd.json --refresh.interval=60
```- Run multiple API endpoints
```
./prometheus-http-sd --api.url="http://api.example.com/foo_service_discovery.json" --output.file=/path/to/http_foo_sd.json --api.url="http://api.example.com/bar_service_discovery.json" --output.file=/path/to/http_bar_sd.json --refresh.interval=60
```## HTTP API format
HTTP API response should be follow prometheus `file_sd_config` format like below:
```json
[
{
"targets": [
"192.0.2.1:8080",
"192.0.2.2:8080",
],
"labels": {
"service": "web",
"role": "role-1"
}
},
{
"targets": [
"192.0.3.1:3306"
],
"labels": {
"service": "db",
"role": "role-2"
}
}
]
```## Example prometheus settings
The part of your `prometheus.yml` is probably as follows.
```
scrape_configs:
- job_name: 'http_sd'
file_sd_configs:
- files:
- /path/to/http_sd.json
```## Metrics
- `prometheus_sd_http_http_requests_total`
- labels
- `api_url`: target API URL
- `code`: http response code