Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / haproxy / haproxy-errors @ ef960abc

Historique | Voir | Annoter | Télécharger (861 octets)

1
#!/bin/sh
2
# Pasha "p01nt" Klets <pasha@klets.name>
3

    
4
name=`basename $0`
5
title=`echo ${name} | awk -F_ '{print $NF}'`
6

    
7
hp_stat() {
8
	echo "show stat" | socat unix-connect:/tmp/haproxy stdio
9
}
10

    
11
labels() {
12
	cat <<EOF
13
req.label requests
14
req.type COUNTER
15
req.draw AREASTACK
16
conn.label connections
17
conn.type COUNTER
18
conn.draw AREASTACK
19
resp.label responses
20
resp.type COUNTER
21
resp.draw AREASTACK
22
EOF
23
}
24

    
25
values() {
26
	cat <<EOF
27
req.value `hp_stat | grep '^'${title}',FRONTEND' | awk -F, '{print $13}'`
28
conn.value `hp_stat | grep '^'${title}',BACKEND' | awk -F, '{print $14}'`
29
resp.value `hp_stat | grep '^'${title}',BACKEND' | awk -F, '{print $15}'`
30
EOF
31
}
32

    
33

    
34
graph_title="${title} errors"
35
graph_vlabel=${title}
36

    
37
case $1 in
38
   config)
39
		cat <<EOF
40
graph_category haproxy
41
graph_title  ${graph_title}
42
graph_vlabel ${graph_vlabel}
43

    
44
`labels`
45
EOF
46
		exit 0
47
	;;
48
esac
49

    
50
values
51

    
52
exit 0