Health Check Script?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jmccaffrey's picture

Does anyone have a good health check script that they use for load balancers to determine the health of a node? This would be something that would simply give the load balancer a true or false response. If fasle was returned, the load balancer would remove the un-healthy node.

Comments

not drupal related?

bertboerland's picture

most of the time, the load balancers have a script that can check the web nods to see if they outut the right data, how fast etc. And then slect to move traffic from the LB to the online fastest webheads.

--

bert boerland

There's also a health-check

dalin's picture

There's also a health-check script in this article on Varnish:
http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

It depends on

perusio's picture

what type of checking you want to do. You can do a lot using something like monit. There's no need to go into PHP land.

What load balancer are you

jburnett's picture

What load balancer are you using? We use LVS and it allows us the ability to generate an md5sum of a page (healthcheck.php) and then each time the load balancer checks for server health it checks that hash against the control hash we put in the config. If they don't match, the node gets kicked from the lb group. We started using this method because there are so many situation where a failure on a web server can return a 200 HTTP status or even return some content, but it was broken and unusable. This also gives us the freedom to make our healthcheck page as simple or comprehensive as we want and we have specific errors returned to that page based on the failure, so troubleshooting of a failed web node is cut down as well.

p.s. sorry if none of this is making sense, I am working on a 26 hour shift..... :(

Ping module for D7

skwashd's picture

I wrote a simple module called ping which is designed to be used for load balancer (or other) health checks. The only output from the menu callback is "OK" and a HTTP status 200. It does a full bootstrap and is set to not cache, so you can tell if the site is really alive or not.

In the past I've looked at options which do more comprehensive checks on the site, but they rely on the checked page/string never changing. I've seen 1 "little" text change take down the whole site because people weren't aware of the load balancer checks. The ping module avoids that problem by only outputting a simple string - not a full page.