HTTP Advanced Controller to Prometheus Pushgateway

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
gatewayer1
New user
Posts: 2
Joined: 04 Apr 2022, 17:14

HTTP Advanced Controller to Prometheus Pushgateway

#1 Post by gatewayer1 » 04 Apr 2022, 17:26

Hello,

hopefully the post is in the right place here.

I tried to send an http request with the Generic HTTP Advanced Controller to a Prometheus Pushgateway but got an error because the controller plugin adds a "\r" at the end of the body line, also if its only one line.
The Prometheus Pushgateway on the other side has limitations:
"Note that in the text protocol, each line has to end with a line-feed character (aka 'LF' or '\n'). Ending a line in other ways, e.g. with 'CR' aka '\r', 'CRLF' aka '\r\n', or just the end of the packet, will result in a protocol error."

So my question is, is there a way to customize the body in some way to meet "only \n" requirement?
I did a custom build already, but I do not find the function I have to change or maybe someone was in the same situation and found a workaround?
Also I tried sending binary and sending without binary option checked... it does not make a difference.

I was building from "mega" branch yesterday.

Hopefully I provided all the necessary information ...

Information Pushgateway: https://github.com/prometheus/pushgatew ... /README.md

Many thanks in advance!

All the best,
Philipp

gatewayer1
New user
Posts: 2
Joined: 04 Apr 2022, 17:14

Re: HTTP Advanced Controller to Prometheus Pushgateway

#2 Post by gatewayer1 » 08 Apr 2022, 13:43

Hello,

I found a solution after some deeper investigation...
So what happens is that if you send a body without a newline inside the gui whether \n nor \r is sent.
If you enter a newline inside the gui both is appended.

Therefore the solution is do not append a newline but append %LF% after your metric.
eg: some_metric 4.3%LF%
Keep an eye on not inserting a newline.
Also activate the checkbox for Send Binary.

All the best :)
Philipp

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: HTTP Advanced Controller to Prometheus Pushgateway

#3 Post by TD-er » 08 Apr 2022, 14:49

Is this specific to this host, or is it according to some standard we should have to follow?

Maybe I can also add an option to explicitly send only \n and force to send at least once ?

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests