HTTP Request to prometheus-pushgateway

Describe the issue/error/question

Looking for way how to do via HTTP Request below curl …

echo “cpu 2” | curl -X POST --data-binary @- http://192.168.14.1:9091/metrics/job/cpu/instance/192.168.1.1

I found some tips on forum for now, but for some other Http Request that not looks like this I have installed

What is the error message (if any)?

No idea how to configure properly HTTP Request to simulate this curl

Please share the workflow

No working node yet, tried so many options but nothing yet works

Information on your n8n setup

  • n8n version: Version 0.201.0
  • Database you’re using (default: SQLite): psql
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: k8s

Hi @P_S, welcome to the community :tada:

A command like echo "cpu 2" | curl -X POST --data-binary @- http://192.168.14.1:9091/metrics/job/cpu/instance/192.168.1.1 would simply send a body of cpu 2 to the specified URL. From testing this against webhook.site it seems curl infers a content-type of application/x-www-form-urlencoded as well here.

The HTTP Request node below should do the same:

You can verify the results using a service such as webhook.site.

curl command echo "cpu 2" | curl -X POST --data-binary @- https://webhook.site/c0e65efa-9a4e-4800-b7ee-be71dad6d72a:

HTTP Request node:

Hope this helps! Let me know if you have any questions on this.

Hello!

Thank you for respond !

I did tried this way, but getting this error.

ERROR: UNKNOWN ERROR - check the detailed error for more information

Details

Time

8.11.2022, 10:46:51

HTTP Code

rejected

Stack

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:1158:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:658:28)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:562:53

Could you share the workflow you currently have?

Sure,

also I tried to use example from here, but was not able to make it working

any clue how to handle this :slight_smile: ?

Hi @P_S, I gave this a go on my side using a URL I have access to but didn’t run into any trouble here:

The request arriving on the server would be this one:

So, I suspect you are running into an error with your API here. Perhaps you can try enabling these response options on your HTTP request node:

image

You should afterwards get the actual error message from the server which hopefully helps with understanding what’s wrong here.

sure, Im getting this

Output

1 item

data

headers

statusCode

statusMessage

text format parsing error in line 1: unexpected end of input stream\n content-type:text/plain; charset=utf-8

x-content-type-options:nosniff

date:Thu, 10 Nov 2022 09:24:39 GMT

content-length:68

connection:close|400|Bad Request|

As i See in HTTP Request in my n8n installation, there is big difference between examples in forum, and what I see in my node , not sure if this is about version or something

for now I work with n8n using standard command and via modify docker image to install curl … but still looking for url help :slight_smile:

Unfortunately, I am not familiar with the service you are sending your request to.

But if you can get it to work with curl, my suggestion would be to simply use a service like webhook.site as your request destination and tweak your settings until both the HTTP Request node and the curl node send the exact same requests.