hashicorp / vault

A tool for secrets management, encryption as a service, and privileged access management
https://www.vaultproject.io/
Other
30.85k stars 4.17k forks source link

vault cli cannot access prometheus metrics #7334

Closed jaloren closed 4 years ago

jaloren commented 5 years ago

Describe the bug

According to the CLI help, i should be able to get the vault prom metrics from prometheus

jlorenzini@jlorenzini-mb tests$ vault path-help sys/metrics
Request:        metrics
Matching Route: ^metrics$

Export the metrics aggregated for telemetry purpose.

## PARAMETERS

    format (string)
        Format to export metrics into. Currently accepts only "prometheus".

## DESCRIPTION

<no description>

However, the vault cli returns an error.

To Reproduce

jlorenzini@jlorenzini-mb tests$ vault read -format=json sys/metrics format="prometheus"
Error reading sys/metrics: invalid character '#' looking for beginning of value

Expected behavior That prometheus metrics should be returned.

Environment:

vault server version

Vault v1.1.3 ('9bc820f700f83a7c4bcab54c5323735a581b34eb')
Key             Value
---             -----
Seal Type       shamir
Initialized     true
Sealed          false
Total Shares    1
Threshold       1
Version         1.1.3
Cluster Name    vault-cluster-1
Cluster ID      e69096a2-2c61-454f-422e-4593a421c2c1
HA Enabled      true
HA Cluster      https://172.26.0.6:8201
HA Mode         active
spangenberg commented 4 years ago

The Error is because the CLI expects JSON to be returned, but the format requested is Prometheus specific. You could use cURL for example to get the Prometheus metrics: curl --header "X-Vault-Token: ..." '.../v1/sys/metrics?format=prometheus'

I'd like to know more about your use case tho, what do you expect the command you posted should return. vault read -format=json sys/metrics format="prometheus" JSON encoded Prometheus metrics like this library [prometheus/prom2json] would do?

spangenberg commented 4 years ago

We haven't heard back regarding this issue in over 16 days. To try and keep our GitHub issues current, we'll be closing this issue in approximately seven days if we do not hear back regarding this issue. Please let us know if you can still reproduce this issue, and if there is any more information you could share, otherwise we'll be closing this issue.

spangenberg commented 4 years ago

Closing for now. Let us know if you have any more information!