From c5fb9db5299fe579ac0482ebc5d2c16d0eee0a6f Mon Sep 17 00:00:00 2001 From: Pasha Klets Date: Fri, 24 Jun 2011 12:00:26 +0200 Subject: [PATCH] Initial version --- plugins/other/haproxy-failed-checks | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 plugins/other/haproxy-failed-checks diff --git a/plugins/other/haproxy-failed-checks b/plugins/other/haproxy-failed-checks new file mode 100755 index 00000000..f161e8b0 --- /dev/null +++ b/plugins/other/haproxy-failed-checks @@ -0,0 +1,46 @@ +#!/bin/sh +# Pasha "p01nt" Klets + +name=`basename $0` +title=`echo ${name} | awk -F_ '{print $NF}'` + +hp_stat() { + echo "show stat" | socat unix-connect:/tmp/haproxy stdio +} + +servers_section() { + hp_stat | grep '^'${title}',' | egrep -v '^'${title}',(FRONTEND|BACKEND)' +} + +servers() { + servers_section | awk -F, '{print $2}' +} + +labels() { + servers_section | awk -F, '{print $2".label "$2"\n"$2".type COUNTER\n"$2".draw AREASTACK"}' +} + +values() { + servers_section | awk -F, '{print $2".value "$22}' +} + + +graph_title="${title} failed checks" +graph_vlabel=${title} + +case $1 in + config) + cat <