I have a Apache + Haproxy + Mongrel Cluster setup. I want to receive alerts whenever my Mongrel queue length gets too high.
How to I get the current Mongrel Queue length and make it available for alerting tools such as Monit and Nagios?
I know that Haproxy has the information about Mongrel queue as it intelligently sends requests to least busy Mongrel in the cluster. I wonder how it finds out? I need a similar mechanism to generate alerts and/or restart mongrels when such a condition arrives.
Add this to your haproxy config
Then use lynx to get the stats like this: (assuming haproxy runs on port 10000 – adjust to suit)
Each there will be a line for each of your server entries in the haproxy config file, telling you whether it’s up or down, how long it’s queue is, like this:
Now all you need is a script to get the current queue (column 6) and feed it into nagios, and you’re away!