Reputation: 2873
I was wondering how I can access the stats of HAProxy remotely without using the web interface. I want to write a code that will query HAProxy's stat to see how many specific servers are down.
I could access the stats through the web interface but I need to parse it. I am trying to avoid this as much as possible. The other thing that I found is that there is a way to query the stats locally using socat, but I am not sure how to query the 'socket' of haproxy remotely or if that is even possible.
Upvotes: 1
Views: 1700
Reputation: 61
I think you're stuck parsing the output of the web interface. Fortunately, haproxy can return everything in csv, so it isn't a difficult task.
You didn't specifically mention Nagios so this might not be exactly what you're looking for, but someone wrote a nifty Nagios plugin to do just this: http://cvs.orion.education.fr/viewvc/viewvc.cgi/nagios-plugins-perl/trunk/plugins/check_haproxy.pl?revision=135&view=markup
Upvotes: 1