Projet

Général

Profil

Révision 32bfecf5

ID32bfecf5a1d2adefcb0e10c83b1eb0b69cf7c477
Parent 8b63e3cd
Enfant d3267c04

Ajouté par Pasha Klets il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/haproxy-response-errors
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
servers_section() {
12
	hp_stat | grep '^'${title}',' |  egrep -v '^'${title}',(FRONTEND|BACKEND)'
13
}
14

  
15
servers() {
16
	servers_section | awk -F, '{print $2}'
17
}
18

  
19
labels() {
20
	servers_section | awk -F, '{print $2".label "$2"\n"$2".type COUNTER\n"$2".draw AREASTACK"}'
21
}
22

  
23
values() {
24
	servers_section | awk -F, '{print $2".value "$15}'
25
}
26

  
27

  
28
graph_title="${title} response errors"
29
graph_vlabel=${title}
30

  
31
case $1 in
32
   config)
33
		cat <<EOF
34
graph_category haproxy
35
graph_title  ${graph_title}
36
graph_vlabel ${graph_vlabel}
37

  
38
`labels`
39
EOF
40
		exit 0
41
	;;
42
esac
43

  
44
values
45

  
46
exit 0

Formats disponibles : Unified diff