-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to push metrics using curl
on MS Windows
#144
Comments
The Pushgateway adheres to the protocol spec, which includes that lines are I don't have access to a current MS Windows installation. I see this mostly as a documentation issue. Help would be appreciated. |
curl
on MS Windows
Your analysis is spot on. Sadly Cygwin wasn't an option for the production environment and Windows Linux Subsystem (to use Ubuntu for MS) requires at least Windows 10 / Server 2016. On the Testing environment we installed Cygwin and that worked flawlessly as it's using GNU echo. It allowed us to catch the windows echo \r using tcpdump at the Pushgateway side. Post-processing with dos2unix seemed the only rapid / valid option at that point. |
I wrote a PowerShell function before, https://github.com/guhuajun/prometheus_posh_client/blob/master/prometheus.psm1. |
Hi, Open a PowerShell console, then use this kind of request Invoke-WebRequest -Uri http://localhost:9091/metrics/job/MyJob -Method POST -Body "Some_Metric 3.14`n" ... but this is strange that nothing is done to accept \r\n and \n and none. One 'if' is at no cost. Bye |
Also, you can try use Postman as described here : https://stackoverflow.com/questions/71161409/postman-to-prometheus-and-carriage-r-text-format-parsing-error-in-line-1-e/71161410 |
python requests can be used for perfect solutions |
On windows using curl.exe and the example
echo "some_metric 3.14" | curl ...
does not work, echo sends the double quotes and pushgateway returns an error. Single quotes get echo'ed also. Getting rid of the double quotes opens another issue. Echo insists on slapping an extra \r character confusing pushgateway. Tryingset /P =some_metric 1<NUL| curl
returns an end-of-stream error from pushgateway.The only way to send
some_metric 3.14
was to echo it to a file, dos2unix that file so it only has a<LF>
and send that usingcurl.exe -d "@file"
to the pushgateway.The text was updated successfully, but these errors were encountered: