napperley
03/08/2020, 3:28 AMcurl_easy_setopt(curlPost, CURLOPT_POSTFIELDS, createPostBody(body).cstr)
Is this the correct way to do it? With the verbose option for libcurl enabled the library prints out 6 for the content length (based on query=up), however the Prometheus server reports that the HTTP request body is missing.napperley
03/08/2020, 9:10 PMnapperley
03/08/2020, 9:12 PMnapperley
03/08/2020, 10:23 PMcurl_easy_setopt(curlPost, CURLOPT_POSTFIELDS, createPostBody(body).cstr.ptr)
After the correction was made Prometheus included the metric in the HTTP response body:
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "up",
"instance": "xxxx:xxxx",
"job": "prometheus"
},
"value": [
1583706055.41,
"1"
]
},
{
"metric": {
"__name__": "up",
"instance": "xxxx:xxxx",
"job": "push_gateway"
},
"value": [
1583706055.41,
"1"
]
},
{
"metric": {
"__name__": "up",
"instance": "xxxx:xxxx",
"job": "node"
},
"value": [
1583706055.41,
"1"
]
}
]
}
}
napperley
03/08/2020, 10:27 PMArtyom Degtyarev [JB]
03/10/2020, 1:01 PMCURLOPT_COPYPOSTFIELDS
option. In your case, it had to be allocated natively and be in memory until the perform is done. It seems to be mentioned in the option’s description here(https://curl.haxx.se/libcurl/c/CURLOPT_POSTFIELDS.html).