Merge lp:~cjwatson/charms/trusty/haproxy/nrpe-handle-backports into lp:charms/trusty/haproxy

Proposed by Colin Watson
Status: Merged
Merged at revision: 93
Proposed branch: lp:~cjwatson/charms/trusty/haproxy/nrpe-handle-backports
Merge into: lp:charms/trusty/haproxy
Diff against target: 21 lines (+8/-1)
1 file modified
files/nrpe/check_haproxy.sh (+8/-1)
To merge this branch: bzr merge lp:~cjwatson/charms/trusty/haproxy/nrpe-handle-backports
Reviewer Review Type Date Requested Status
Tim Van Steenburgh (community) Approve
Adam Israel (community) Approve
Review via email: mp+257416@code.launchpad.net

Commit message

Fix Nagios checks to handle haproxy 1.5.

Description of the change

Fix Nagios checks to handle haproxy 1.5.

dumpstats has changed the HTML classes used to denote UP statuses from active2/active3/backup2/backup3 to active3/active4/backup3/backup4.

To post a comment you must log in.
Revision history for this message
Adam Israel (aisrael) wrote :

Hi Colin,

I had the chance to review this merge proposal today. The change you've made is pretty straightforward, and all tests are passing. LGTM. +1

review: Approve
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

+1, LGTM, thanks Colin!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'files/nrpe/check_haproxy.sh'
2--- files/nrpe/check_haproxy.sh 2013-03-27 15:41:26 +0000
3+++ files/nrpe/check_haproxy.sh 2015-04-24 16:20:34 +0000
4@@ -11,9 +11,16 @@
5 LOGFILE=/var/log/nagios/check_haproxy.log
6 AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')
7
8+HAPROXY_VERSION="$(dpkg-query -W --showformat='${Version}\n' haproxy)"
9+if dpkg --compare-versions "$HAPROXY_VERSION" ge 1.5; then
10+ CLASS_REGEX='(active|backup)(3|4)'
11+else
12+ CLASS_REGEX='(active|backup)(2|3)'
13+fi
14+
15 for appserver in $(grep ' server' /etc/haproxy/haproxy.cfg | awk '{print $2'});
16 do
17- output=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 10000 --regex="class=\"(active|backup)(2|3).*${appserver}" -e ' 200 OK')
18+ output=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 10000 --regex="class=\"$CLASS_REGEX.*${appserver}" -e ' 200 OK')
19 if [ $? != 0 ]; then
20 date >> $LOGFILE
21 echo $output >> $LOGFILE

Subscribers

People subscribed via source and target branches

to all changes: