From 8b63e3cd9653f2e8da14347cfc762dde0758cd89 Mon Sep 17 00:00:00 2001 From: Pasha Klets Date: Fri, 24 Jun 2011 12:07:44 +0200 Subject: [PATCH] Initial version --- plugins/other/haproxy-sessions-by-servers | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 plugins/other/haproxy-sessions-by-servers diff --git a/plugins/other/haproxy-sessions-by-servers b/plugins/other/haproxy-sessions-by-servers new file mode 100755 index 00000000..548a2ae0 --- /dev/null +++ b/plugins/other/haproxy-sessions-by-servers @@ -0,0 +1,45 @@ +#!/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 GAUGE\n"$2".draw AREASTACK"}' +} + +values() { + servers_section | awk -F, '{print $2".value "$5}' +} + +graph_title="${title} sessions by servers" +graph_vlabel=${title} + +case $1 in + config) + cat <