Unable to send the metric to prometheus

Hello folks,
I am trying to send my k6 metrics to prometheus for that i have done the following thing.

  1. i have installed prometheus and it is up and running at port 9090.
  2. after that i am using command “k6 run -o experimental-prometheus-rw sampleScript.js”

I am getting following error :
ERRO[0003] Failed to send the time series data to the endpoint error=“got status code: 404 instead expected a 2xx successful status code” output=“Prometheus remote write”

Do i have to make any configuration in prometheus , or m i missing somethings , please help!!

Hi @ajay

Welcome to the community forum :wave:

I understand you are running experimental prometheus remote write output. It does seem that prometheus’ remote endpoint write API is not “located” at the default K6_PROMETHEUS_RW_SERVER_URL, which is http://localhost:9090/api/v1/write.

I would suspect your Prometheus does not have remote write receiver enabled, which is usually done with --web.enable-remote-write-receiver, as documented in Prometheus remote write.

You can check this with

curl -X POST http://localhost:9090/api/v1/write

Which will return remote write receiver needs to be enabled with --enable-feature=remote-write-receiver. Note that the flag has been deprecated and is now --web.enable-remote-write-receiver.

If this is the case, running curl -v -X POST http://localhost:9090/api/v1/write, in verbose, you would also see that your Prometheus is returning a HTTP/1.1 404 Not Found. Same as the errors you see got status code: 404.

Let me know if that helps.

Cheers!

Yes it helps , thanks a lot @eyeveebe

1 Like