I have two backend web servers, and i need to monitor them using httpcheck by checking the URL and looking for a string to be present in the response of the request. if the string is not available switch the backend to another server.
Status:
- Server1 - Active
- Server2 - Backup
Configuration Details:
- Health Check Method : HTTP
- HTTP Check Method : GET
- Url used by http check requests:
/jsonp/FreeForm&maxrecords=10&format=XML&ff=223
- Http check version : HTTP/1.0\r\nAccept:\ XS01
Result of the http Request is
{"d":{"__type":"Response","Version":"4.5.23.1160","ResultCode":"XS01","ErrorString":"","Results":[{"__type":"Result",
so, I am expecting the string ResultCode":"XS01"
in the response from the server, if the string found the server1 is up, if not bring the Server2 from the backup.
how can i achieve this in HAProxy Backend Health Check?
CodePudding user response:
This can be done under Advanced Settings--> Backend Pass thru using the expect string,
http-check expect string XS01