Using this [https://github.com/prometheus/pushgateway][1] we are trying to push one metric to prometheus. It seems to require the data in a very specific format.
It works fine when doing their example curl of
echo "some_metric 3.14" | curl --data-binary @- http://pushgateway.example.org:9091/metrics/job/some_job
Yet doing a curl with -d option fails as missing end of line/file
curl -d 'some_metric 3.15\n' http://pushgateway.example.org:9091/metrics/job/some_job
I'm trying to understand the difference in behaviour since I believe both are doing POST commands and I need to replicate this --data-binary option in node.js via "request.post" method but I seem to only be able to replicate the curl -d option which doesn't work.
Any suggestions on hints on what the difference is between -d and --data-binary and to do the equivalent to --data-binary from within node.js?
curlcommand with its different flags? or are you trying to send a NodeJS POST request to push metrics to push Gateway?'\n'in Bash isn't a newline, it's the letter "n". You want to use ANSI C quoted strings:curl -d $'some_metric 3.15\n'