Projet

Général

Profil

Révision 4f29ff59

ID4f29ff59b13c0fae4c46eb7d9ee8f03256661965
Parent a717a913
Enfant 73bf794a, 4771fd2b

Ajouté par rfrail3 il y a environ 13 ans

Add support for sockets

Voir les différences:

plugins/haproxy/haproxy_abort_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44
        
45

  
46
	if [ ! -z "$url" ]; then
47
		LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
	        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
	if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`         
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_active_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
	PXNAME="$1"
40 43
	SVNAME="$2"
41 44
	VALUE="$3"
42
	LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
	LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45

  
46
	if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
	ARRAY1=($LINE1);
46 56

  
47 57
	# Find values
plugins/haproxy/haproxy_bytes_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
	if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_bytes_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_denied_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_denied_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_errors_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_errors_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_queue_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
......
63 73

  
64 74
SVNAME='BACKEND'
65 75
LIST=$backend
76
WARN_PERCENT="80"
66 77

  
67 78

  
68 79

  
......
91 102
        	#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
92 103
	        #echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
93 104
        	#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max queued request $i"
105
		
106
		echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Limit request `echo $i | awk -F. '{print $NF}'`"
107
                echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
108
                echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
109
                echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit request `echo $i | awk -F. '{print $NF}'`"
110

  
111
		QLIM=`parse_url ${i} ${SVNAME} qlimit`
112
                if [[ "$QLIM" =~ ^[0-9]+$ ]] && [[ "$QLIM" != 0 ]]; then
113
                        echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $QLIM"
114
                fi
115

  
116
                if [[ "$QLIM" =~ ^[0-9]+$ ]] && [[ "$QLIM" != 0 ]]; then
117
                        echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${QLIM}*${WARN_PERCENT}/100))"
118
                fi
94 119
	done
95 120

  
96 121
	exit 0
......
98 123
	for i in ${LIST}; do
99 124
		QCUR=`parse_url ${i} ${SVNAME} qcur`
100 125
		#QMAX=`parse_url ${i} ${SVNAME} qmax`
126
		QLIM=`parse_url ${i} ${SVNAME} qlimit`
101 127

  
102 128
	        echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QCUR"
129
		echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QLIM"
103 130
        	#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QMAX"
104 131
	done
105 132
	
plugins/haproxy/haproxy_rate_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
......
63 73

  
64 74
SVNAME='BACKEND'
65 75
LIST=$backend
76
WARN_PERCENT="80"
66 77

  
67 78
if [ "$1" = "autoconf" ]; then
68 79
	echo yes 
......
95 106
	        #echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
96 107
        	#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max number of new sessions per second $i"
97 108

  
109
		RATEL=`parse_url ${i} ${SVNAME} rate_lim`
110
                if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
111
                        echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $RATEL"
112
                fi
113

  
114
                if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
115
                        echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${RATEL}*${WARN_PERCENT}/100))"
116
                fi
117

  
98 118
	done
99 119

  
100 120
	exit 0
plugins/haproxy/haproxy_rate_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
......
63 73

  
64 74
SVNAME='FRONTEND'
65 75
LIST=$frontend
76
WARN_PERCENT="80"
66 77

  
67 78

  
68 79
if [ "$1" = "autoconf" ]; then
......
96 107
	        #echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
97 108
        	#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max number of new sessions per second $i"
98 109

  
110
		RATEL=`parse_url ${i} ${SVNAME} rate_lim`
111
                if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
112
                        echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $RATEL"
113
                fi
114

  
115
                if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
116
                        echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${RATEL}*${WARN_PERCENT}/100))"
117
                fi
99 118
	done
100 119

  
101 120
	exit 0
plugins/haproxy/haproxy_reqrate_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_responses_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
	PXNAME="$1"
40 43
	SVNAME="$2"
41 44
	VALUE="$3"
42
	LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
	LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
45

  
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
44 55

  
45 56
	ARRAY1=($LINE1);
46 57

  
plugins/haproxy/haproxy_responses_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
	PXNAME="$1"
40 43
	SVNAME="$2"
41 44
	VALUE="$3"
42
	LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
	LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
45

  
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
44 55

  
45 56
	ARRAY1=($LINE1);
46 57

  
......
119 130
		H3xx=`parse_url ${i} ${SVNAME} hrsp_3xx`
120 131
		H4xx=`parse_url ${i} ${SVNAME} hrsp_4xx`
121 132
		H5xx=`parse_url ${i} ${SVNAME} hrsp_5xx`
122
		Hoxx=`parse_url ${i} ${SVNAME} hrsp_other`
133
		Hother=`parse_url ${i} ${SVNAME} hrsp_other`
123 134
	        echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H1xx"
124 135
	        echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H2xx"
125 136
	        echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H3xx"
126 137
	        echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H4xx"
127 138
	        echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H5xx"
128
	        echo "hrsp_oxx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hoxx"
139
	        echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hother"
129 140
	done
130 141
	
plugins/haproxy/haproxy_sessions_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
......
63 73

  
64 74
SVNAME='BACKEND'
65 75
LIST="$backend"
76
WARN_PERCENT="80"
66 77

  
67 78

  
68 79
if [ "$1" = "autoconf" ]; then
......
95 106
        	echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
96 107
	        echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
97 108
        	echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit Sessions $i"
109

  
110
		SLIM=`parse_url ${i} ${SVNAME} slim`
111
                if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
112
                   echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $SLIM"
113
                fi
114
                if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
115
                        echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${SLIM}*${WARN_PERCENT}/100))"
116
                fi
98 117
	done
99 118

  
100 119
	exit 0
plugins/haproxy/haproxy_sessions_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
......
63 73

  
64 74
SVNAME='FRONTEND'
65 75
LIST="$frontend"
76
WARN_PERCENT="80"
66 77

  
67 78

  
68 79
if [ "$1" = "autoconf" ]; then
......
95 106
        	echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
96 107
	        echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
97 108
        	echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit Sessions $i"
109

  
110
		SLIM=`parse_url ${i} ${SVNAME} slim`
111
                if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
112
                   echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $SLIM"
113
                fi
114
                if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
115
                        echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${SLIM}*${WARN_PERCENT}/100))"
116
                fi
98 117
	done
99 118

  
100 119
	exit 0
plugins/haproxy/haproxy_sessions_total_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_sessions_total_frontend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  
plugins/haproxy/haproxy_warnings_backend
13 13
  user root
14 14
  env.backend backend_name_1 backend_name_2 backend_name_3
15 15
  env.frontend frontend_name_1 frontend_name_2 frontend_name_3
16
  env.url  http://user:passwd@IP:port/admin?stats;csv
16
  # You can use url o socket option, use one of them, not both!
17
    env.url  http://user:passwd@IP:port/admin?stats;csv
18
  #  or
19
    env.socket /var/lib/haproxy/stats.socket
17 20

  
18 21
=head1 AUTHOR
19 22

  
......
39 42
        PXNAME="$1"
40 43
        SVNAME="$2"
41 44
        VALUE="$3"
42
        LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
43
        LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
44 45
        
46
        if [ ! -z "$url" ]; then
47
                LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
48
                LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
49
        fi
50

  
51
        if [ ! -z "$socket" ]; then
52
                LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
53
                LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
54
        fi
45 55
        
46 56
        ARRAY1=($LINE1);
47 57

  

Formats disponibles : Unified diff