According to this page, it should be possible to scrape metrics from Influxdb using Prometheus.
In my experience however, the remote_write
end-point works, but not the remote_read
.
Here’s my setup in influxdb:
> CREATE USER readuser WITH PASSWORD 'foo'
> CREATE USER writeuser WITH PASSWORD 'bar'
> CREATE DATABASE prometheus
> GRANT WRITE ON prometheus TO writeuser
> GRANT READ ON prometheus TO readuser
I’ve then successfully configured Prometheus to push metrics using:
remote_write:
- url: "http://1.2.3.4:8086/api/v1/prom/write?u=writeuser&p=bar&db=prometheus"
I can see those writes appearing in the logs just fine.
When I try to query the database however, I get a 405 error:
$ curl -i "http://1.2.3.4:8086/api/v1/prom/read?u=readuser&p=foo&db=prometheus"
HTTP/1.1 405 Method Not Allowed
Allow: POST
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.4.3
Date: Thu, 05 Apr 2018 17:17:31 GMT
Content-Length: 19
Method Not Allowed
The corresponding stanza I tried with in the Prometheus config file was:
remote_read:
- url: "http://1.2.3.4:8086/api/v1/prom/read?u=readuser&p=foo&db=prometheus"
Anyone got any ideas?
I also tried a POST, which makes no sense in this context IMHO:
$ curl -i -XPOST "http://1.2.3.4:8086/api/v1/prom/read?u=readuser&p=foo&db=prometheus"
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: ca5ab3e2-38f7-11e8-9f76-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Error: snappy: corrupt input
X-Influxdb-Version: 1.4.3
X-Request-Id: ca5ab3e2-38f7-11e8-9f76-000000000000
Date: Thu, 05 Apr 2018 17:35:53 GMT
Content-Length: 34
{"error":"snappy: corrupt input"}