How can I check for different strings using the NodeBalancer Health Check?
I have a few different nodes configured to work with a NodeBalancer. I want to use the Active Health Checks feature to look for specific strings in the HTTP Body to verify its UP status. However, I need to look for different strings on each node.
How can I achieve this?
1 Reply
As you may know, the 'HTTP Body'
Health Check uses a regex to match against an expected result body. So, you could use the OR operator |
to check for different strings on each node.
Let's say you have three backend nodes with the following strings somewhere on the page:
Node Name: Database
String: in sync
Node Name: Site 1
String: is running
Node Name: Site 2
String: is running
You would be able to add the following value to the Expected HTTP Body (required)
section of your NodeBalancer's configuration page:
running|sync
Afterward, allow a few minutes to the changes to sync up, and you should find that both nodes has a Status of UP
.
You may learn more about Regex operators with this Regex Cheatsheet from Debuggex.
You may also find the following guides helpful for reference: