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
=== modified file 'files/nrpe/check_haproxy.sh'
--- files/nrpe/check_haproxy.sh 2013-03-27 15:41:26 +0000
+++ files/nrpe/check_haproxy.sh 2015-04-24 16:20:34 +0000
@@ -11,9 +11,16 @@
11LOGFILE=/var/log/nagios/check_haproxy.log11LOGFILE=/var/log/nagios/check_haproxy.log
12AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')12AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')
1313
14HAPROXY_VERSION="$(dpkg-query -W --showformat='${Version}\n' haproxy)"
15if dpkg --compare-versions "$HAPROXY_VERSION" ge 1.5; then
16 CLASS_REGEX='(active|backup)(3|4)'
17else
18 CLASS_REGEX='(active|backup)(2|3)'
19fi
20
14for appserver in $(grep ' server' /etc/haproxy/haproxy.cfg | awk '{print $2'});21for appserver in $(grep ' server' /etc/haproxy/haproxy.cfg | awk '{print $2'});
15do22do
16 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')23 output=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 10000 --regex="class=\"$CLASS_REGEX.*${appserver}" -e ' 200 OK')
17 if [ $? != 0 ]; then24 if [ $? != 0 ]; then
18 date >> $LOGFILE25 date >> $LOGFILE
19 echo $output >> $LOGFILE26 echo $output >> $LOGFILE

Subscribers

People subscribed via source and target branches

to all changes: