Hi guys, I need your help please. I need to configure a monitor to do a post and get a 204, but it is not working. If I do a curl like this, I get the http 204 that I am looking:
curl -X POST -sL '[http://192.168.10.131/api/rest/checks/v0/void](http://192.168.10.131/api/rest/checks/v0/void)' -H 'Authorization: Basic ZjUZjjU=' -H 'Content-Type: application/json' -d '{"data": ""}' -m 30 -v
Below the monitor I configured and it is not working.
ltm monitor http TEST_POST {
adaptive disabled
defaults-from http
destination *:*
interval 3
ip-dscp 0
recv "HTTP/1.1 (204)"
recv-disable none
send "POST /api/rest/checks/v0/void HTTP/1.1\r\nHost: 192.168.10.131\r\nAuthorization: Basic ZjUZjjU= \r\n"
time-until-up 0
timeout 10
Thanks in advance and sorry in advance if the mistake is too silly.
Hamish
January 18, 2019, 1:21pm
2
Please edit your question to put the config in code blocks…
Hamish
January 18, 2019, 1:22pm
3
At a first glance I’d say you’re missing an extra \r\n at the end of your POST (HTTP/1.1 requires a blank line after the query so the server knows you’re finished).
If you edit your question to add codeblocks around the parts that show your config/code it would be a lot easier…
Hi,
before writing a monitor, you must know how the request is sent:
POST /api/rest/checks/v0/void HTTP/1.1
Host: 192.168.2.34
Accept: */*
Authorization: Basic ZjUZjjU=
Content-Type: application/json
Content-Length: 12
{"data": ""}
The POST data are always after a blank line without any content
You must replace any new line by
\r\n
, and don’t add a space before new lines :
ZjUZjjU= \r\n
is wrong because on the space before
\r\n
the monitor string must be :
POST /api/rest/checks/v0/void HTTP/1.1\r\nHost: 192.168.2.34\r\nAccept: */*\r\nAuthorization: Basic ZjUZjjU=\r\nContent-Type: application/json\r\nContent-Length: 12\r\n\r\n{"data": ""}
try first the send string syntax from bigip with this:
SEND_STRING='POST /api/rest/checks/v0/void HTTP/1.1\r\nHost: 192.168.2.34\r\nAccept: */*\r\nAuthorization: Basic ZjUZjjU=\r\nContent-Type: application/json\r\nContent-Length: 12\r\n\r\n{"data": ""}'
(echo -ne $SEND_STRING; cat) | nc 192.168.2.34 80
You can look at this link on how to check monitor syntax and get response data to build monitor receive string.