2
#--------------------------------------------
3
# This file is managed by Juju
4
#--------------------------------------------
6
# Copyright 2009,2012 Canonical Ltd.
11
LOGFILE=/var/log/nagios/check_haproxy.log
12
AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')
14
for appserver in $(grep ' server' /etc/haproxy/haproxy.cfg | awk '{print $2'});
16
output=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 --regex="class=\"(active|backup)(2|3).*${appserver}" -e ' 200 OK')
19
echo $output >> $LOGFILE
20
/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 -v | grep $appserver >> $LOGFILE 2>&1
22
NOTACTIVE="${NOTACTIVE} $appserver"
26
if [ $CRITICAL = 1 ]; then
27
echo "CRITICAL:${NOTACTIVE}"
31
echo "OK: All haproxy instances looking good"