I have this in prometheus.yml
scrape_configs:
- job_name: "sia_hostd"
static_configs:
- targets: ["localhost:9980"]
metrics_path: "/api/metrics?response=prometheus"
basic_auth:
username: "admin"
password: "***"
scrape_interval: 300s
The problem is with the question mark character from the metrics path. Prometheus changes it to %3F, and the hostd daemon gives 404 page not found
To be more clear, if I open in a web browser this link http://myhost:9980/api/metrics?response=prometheus I see the metrics.
If I open http://myhost:9980/api/metrics%3Fresponse=prometheus I get 404 page not found
What do I write in prometheus.yml? Already tried using %3F in there, it’s worse.
Prometheus version 2.50.0-rc.0
hostd version 1.0.3-beta.1
Nate
2
You can set query parameters in the params
field
scrape_configs:
- job_name: hostd_host_state
scrape_interval: 30s
metrics_path: /api/state/host
scheme: http
params:
response:
- prometheus
basic_auth:
password: sia is cool
static_configs:
- targets: ['localhost:9980']
- job_name: hostd_metrics
scrape_interval: 30s
metrics_path: /api/metrics
scheme: http
params:
response:
- prometheus
basic_auth:
password: sia is cool
static_configs:
- targets: ['localhost:9980']
- job_name: hostd_consensus_state
scrape_interval: 30s
metrics_path: /api/state/consensus
scheme: http
params:
response:
- prometheus
basic_auth:
password: sia is cool
static_configs:
- targets: ['localhost:9980']
- job_name: hostd_wallet
scrape_interval: 30s
metrics_path: /api/wallet
scheme: http
params:
response:
- prometheus
basic_auth:
password: sia is cool
static_configs:
- targets: ['localhost:9980']
- job_name: hostd_alerts
scrape_interval: 30s
metrics_path: /api/alerts
scheme: http
params:
response:
- prometheus
basic_auth:
password: sia is cool
static_configs:
- targets: ['localhost:9980']
- job_name: hostd_volumes
scrape_interval: 30s
metrics_path: /api/volumes
scheme: http
params:
response:
- prometheus
basic_auth:
password: sia is cool
static_configs:
- targets: ['localhost:9980']
1 Like