Hi Team,
I’m running a k6 on a remote Jenkins slave, and it work perfectly with InfluxDB out, but when i try to run with Prometheus is throws an error.
time=“2023-12-07T06:45:58Z” level=error msg=“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”
the execute shell
K6_PROMETHEUS_RW_SERVER_URL=http://myserver:9090/api/v1/write
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true
k6 run -o experimental-prometheus-rw -e K6_BROWSER_HEADLESS=false .\src\tests\script.js
Prometheus running on the same machine where InfluxDB, therefore hope there is no connectivity issue. Looks like the command I run on the shell have problem. Also guide me how to pass the server URL and histogram option.
K6_PROMETHEUS_RW_SERVER_URL=http://myserver:9090/api/v1/write
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
Hi @gerardlj !
I assume form the response code: 404 , that the remote write receiver is not enabled in your prometheus instance. I think curl -X POST myserver:9090/api/v1/write
command would print the following message for you: remote write receiver needs to be enabled with --web.enable-remote-write-receiver
If that is true, then you have to enable it with the given flag.
I hope this helps you
2 Likes
I try to run the docker with the below command. But throw some error
docker run --add-host=host.docker.internal:host-gateway -e ENABLE_FEATURE=web.enable-remote-write-receiver -e ENABLE_FEATURE=native-histograms -e CONFIG_FILE=/etc/prometheus/prometheus.yml -p 0.0.0.0:9090:9090 --name=Prometheus --volume prom-data:/var/lib/prometheus prom/prometheus:latest
What is the error message?
For me enabling the remote write receiver works like this:
docker run ... prom/prometheus:latest --web.enable-remote-write-receiver
1 Like