I am trying to push the metrics from the value I derived from the zuul logs in ansible playbook. Below is the code:
- name: Push AF Upload metrics win_shell: > curl -X POST --netrc -H "Content-type: application/json" -d ' # TYPE artifactory_upload_duration gauge # HELP artifactory_upload_duration artifactory upload duration artifactory_upload_duration {{ af_upload_duration }} # TYPE artifactory_upload_size gauge # HELP artifactory_upload_size artifactory upload size artifactory_upload_size {{ af_upload_size }} # TYPE artifactory_upload_speed gauge # HELP artifactory_upload_speed artifactory upload speed artifactory_upload_speed {{ af_upload_speed }}' "https://**************/pushgateway/metrics/job/AFUpload_test"
in my zuul console, I see below: curl -X POST --netrc -d ' # TYPE artifactory_upload_duration gauge # HELP artifactory_upload_duration artifactory upload duration artifactory_upload_duration Duration: 2 seconds # TYPE artifactory_upload_size gauge # HELP artifactory_upload_size artifactory upload size artifactory_upload_size Size: 0.128284 MB # TYPE artifactory_upload_speed gauge # HELP artifactory_upload_speed artifactory upload speed artifactory_upload_speed Speed: 0.47 MBit/s' "https://************/pushgateway/metrics/job/AFUpload_test"
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 499 100 68 100 431 805 5103 --:--:-- --:--:-- --:--:-- 5940 text format parsing error in line 1: unexpected end of input stream
I can see the metrics in prometheus pushgateway, however, the value is incorrect as well as the graph I created using the metric in also just a simple horizontal line.
How to resolve this issue?
I tried putting values in quotes as well as removed the units of the value and run the curl command locally, but got the same error.