consul_exporter icon indicating copy to clipboard operation
consul_exporter copied to clipboard

Not able to get key value metrics exported

Open mjnasir opened this issue 4 years ago • 10 comments

I am trying to load kv from consul with --kv.prefix=/. Its bringing nothing

mjnasir avatar Feb 19 '20 14:02 mjnasir

Can you share the exporter's logs as well as command line flags?

simonpasquier avatar Feb 20 '20 15:02 simonpasquier

Logs are level=info ts=2020-02-19T12:59:41.596Z caller=consul_exporter.go:462 msg="Starting consul_exporter" version="(version=0.6.0, branch=HEAD, revision=79bc2cc7095de15a843a538a8edc3f1f254c2848)" level=info ts=2020-02-19T12:59:41.597Z caller=consul_exporter.go:463 build_context="(go=go1.13.5, user=root@4a16293ae5a8, date=20191216-15:37:09)" level=info ts=2020-02-19T12:59:41.597Z caller=consul_exporter.go:514 msg="Listening on address" address=:9107

and flag are --kv.prefix=/

mjnasir avatar Feb 20 '20 16:02 mjnasir

I presume that you have no numeric value. From README.md:

Keys with non-numeric values are omitted

simonpasquier avatar Feb 20 '20 16:02 simonpasquier

Nope. none even not able to read numeric values

mjnasir avatar Feb 20 '20 16:02 mjnasir

I've just checked and it works for me.

simonpasquier avatar Feb 20 '20 16:02 simonpasquier

Colud you please share with me key and its value, and also please share flags Thanks in advance

mjnasir avatar Feb 20 '20 16:02 mjnasir

The flags are --kv.prefix=/, my key is foo and its value is 1.20.

simonpasquier avatar Feb 20 '20 16:02 simonpasquier

I have the same issue. I found that the value stored in Consul kv storage is encoded with base64 by default, but I did not find decode operation in https://github.com/prometheus/consul_exporter/blob/master/consul_exporter.go#L428 Is that the reason?

I add the key by HTTP API, e.g.

curl \
  --insecure \
  --header "X-Consul-Token: <token>" \
  --request PUT \
  "https://localhost:8501/v1/kv/xxx" \
  -d '123'

yujhe avatar Aug 27 '20 09:08 yujhe

I solved it by adding the right permission for the consul agent ACL token.

yujhe avatar Aug 28 '20 03:08 yujhe

@yujhe Do you mind sharing what were the right permissions?

pmmalinov01 avatar Sep 20 '21 15:09 pmmalinov01