~ibm-charms/charms/trusty/nova-compute-power/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh

  • Committer: james.page at ubuntu
  • Date: 2015-06-17 09:08:47 UTC
  • mfrom: (74.2.46 nova-compute-power)
  • Revision ID: james.page@ubuntu.com-20150617090847-ork7zgglosiiqs7y
Merge updates for OpenStack Kilo release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#--------------------------------------------
 
3
# This file is managed by Juju
 
4
#--------------------------------------------
 
5
#                                       
 
6
# Copyright 2009,2012 Canonical Ltd.
 
7
# Author: Tom Haddon
 
8
 
 
9
# These should be config options at some stage
 
10
CURRQthrsh=0
 
11
MAXQthrsh=100
 
12
 
 
13
AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')
 
14
 
 
15
HAPROXYSTATS=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 -u '/;csv' -v)
 
16
 
 
17
for BACKEND in $(echo $HAPROXYSTATS| xargs -n1 | grep BACKEND | awk -F , '{print $1}')
 
18
do
 
19
    CURRQ=$(echo "$HAPROXYSTATS" | grep $BACKEND | grep BACKEND | cut -d , -f 3)
 
20
    MAXQ=$(echo "$HAPROXYSTATS"  | grep $BACKEND | grep BACKEND | cut -d , -f 4)
 
21
 
 
22
    if [[ $CURRQ -gt $CURRQthrsh || $MAXQ -gt $MAXQthrsh ]] ; then
 
23
        echo "CRITICAL: queue depth for $BACKEND - CURRENT:$CURRQ MAX:$MAXQ"
 
24
        exit 2
 
25
    fi
 
26
done
 
27
 
 
28
echo "OK: All haproxy queue depths looking good"
 
29
exit 0
 
30