Skip to content

How to use curl for remote write? #2489

Discussion options

You must be logged in to vote

To make remote write work from curl, you need to:

  1. prepare remote-write request. This is snappy-compressed WriteRequest protobuf message from this proto file: https://github.com/prometheus/prometheus/blob/main/prompb/remote.proto
  2. send it to /api/v1/push with "Content-Type: application/x-protobuf" header.

So this works:

curl -v -X POST -H 'X-Scope-OrgID: anonymous' -H "Content-Type: application/x-protobuf" http://localhost:9009/api/v1/push --data-binary @/tmp/req

> POST /api/v1/push HTTP/1.1
> Host: localhost:9009
> User-Agent: curl/7.79.1
> Accept: */*
> X-Scope-OrgID: anonymous
> Content-Type: application/x-protobuf
> Content-Length: 1
>
< HTTP/1.1 200 OK
< Server: nginx/1.21.6
< Date:…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@huy7070
Comment options

@pstibrany
Comment options

@huy7070
Comment options

@pracucci
Comment options

Answer selected by huy7070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants