2

I am trying to send metrics to pushgateway from windows. But I get the following error:

text format parsing error in line 1: invalid metric name

This is the command I run from the console:

echo "some_metric 10" | curl --data-binary @ - http: // localhost: 9091 / metrics / job / some_job

How could I send my metrics from windows console?

Thanks

2 Answers2

1

I run into the same issue, I guess it has something to do with running it on windows. You can try doing it with a powershell script, this worked for me:

Invoke-WebRequest -Uri http://localhost:9091/metrics/job/some_job -Method POST
victooor
  • 330
  • 3
  • 7
1

I had another error running commands from Windows Powershell using both curl.exe and Invoke-WebRequest:

curl.exe -X PUT -d "some_metric 3.14" http://localhost:9091/metrics/job/some_job

echo "some_metric 10" | Invoke-WebRequest -Uri http://localhost:9091/metrics/job/some_job -Method POST

Here is the error message:

text format parsing error in line 1: unexpected end of input stream

I found out that it does not pass line feed which is necessary according to the official document:

Note that in the text protocol, each line has to end with a line-feed character (aka 'LF' or '\n'). Ending a line in other ways, e.g. with 'CR' aka '\r', 'CRLF' aka '\r\n', or just the end of the packet, will result in a protocol error.

so I put a line feed at the end of data, and it works now:

curl.exe -X PUT -d "some_metric 3.14
>> " http://localhost:9091/metrics/job/some_job

As alternative I could also run with Invoke-WebRequest command:

echo "some_metric 20
>> " | Invoke-WebRequest -Uri http://localhost:9091/metrics/job/some_job -Method POST
Saeed Mohtasham
  • 1,693
  • 16
  • 27