How to specify the timestamp with the Influx endpoint?

  • What Grafana version and what operating system are you using?

I’m using Grafana Cloud, free tier.

  • What are you trying to achieve?

I’m trying to send a data point to Prometheus using the InfluxDB compatible endpoint (namely “Configure sending metrics via HTTP” in my Grafana Cloud stack management interface)

  • How are you trying to achieve it?

Here is my curl command

curl -X  POST -H  "Authorization: Bearer $API_KEY" -H  "Content-Type: text/plain" "$URL" -d "test,bar_label=cdr metric=35.2 1465839830100400200"

which is basically a copy&paste from the curl example found in my Grafana Cloud account when adding a new connection of type “HTTP Metrics”: I’ve just added the timestamp at the end, which seems to be syntactically correct as per the InfluxDB Line Protocol, but it seems to be refused by this endpoint.

  • What happened?

I get:

{"code":"invalid","message":"bad metrics write request"}

If I issue the same command, without the trailing timestamp, it works, but it’s not what I need.

  • What did you expect to happen?

I assume the InfluxDB Line Protocol syntax I’m sending is correct: at least I can’t spot any mistakes. I expected it to work…

Can you please help me find and fix the problem?

That is Mon Jun 13 2016 17:43:50 GMT+0000. That InfluxDB endpoint is just wrapper on top of Prometheus and Prometheus doesn’t support historic data by design. Test your requests with some recent timestamp - e.g. 5 min ago, not a few years ago.