3 crsproxy_url="http://127.0.0.1:7999/counters?"
7 # check once if the url works
8 wget 2>/dev/null -O /dev/null "$crsproxy_url"
11 echo >&2 "crsproxy: cannot fetch the url: $crsproxy_url. Please set crsproxy_url='url' in $confd/crsproxy.conf"
15 if [ -z "$crsproxy_cmds" ]
17 crsproxy_cmds="`wget 2>/dev/null -O - "$crsproxy_url" | egrep "^cmd_[a-zA-Z][a-zA-Z0-9]_[a-z_]+ *= *[0-9]+$" | cut -d '_' -f 2 | sort -u`"
20 if [ -z "$crsproxy_cmds" ]
22 echo >&2 "crsproxy: cannot find command list automatically. Please set crsproxy_cmds='...' in $confd/crsproxy.conf"
31 CHART crsproxy.connected '' "CRS Proxy Connected Clients" "clients" crsproxy '' line 20000 $update_every
32 DIMENSION web '' absolute-no-interpolation 1 1
33 DIMENSION native '' absolute-no-interpolation 1 1
34 DIMENSION virtual '' absolute-no-interpolation 1 1
35 CHART crsproxy.requests '' "CRS Proxy Requests Rate" "requests/s" crsproxy '' area 20001 $update_every
36 DIMENSION web '' incremental-no-interpolation 1 1
37 DIMENSION native '' incremental-no-interpolation -1 1
38 CHART crsproxy.clients '' "CRS Proxy Clients Rate" "clients/s" crsproxy '' area 20010 $update_every
39 DIMENSION web '' incremental-no-interpolation 1 1
40 DIMENSION native '' incremental-no-interpolation -1 1
41 DIMENSION virtual '' incremental-no-interpolation 1 1
42 CHART crsproxy.replies '' "CRS Replies Rate" "replies/s" crsproxy '' area 20020 $update_every
43 DIMENSION ok '' incremental-no-interpolation 1 1
44 DIMENSION failed '' incremental-no-interpolation -1 1
45 CHART crsproxy.bconnections '' "Back-End Connections Rate" "connections/s" crsproxy '' area 20030 $update_every
46 DIMENSION ok '' incremental-no-interpolation 1 1
47 DIMENSION failed '' incremental-no-interpolation -1 1
51 echo "CHART crsproxy.commands '' 'CRS Commands Requests' 'requests/s' crsproxy '' stacked 20100 $update_every"
52 for x in $crsproxy_cmds
54 echo "DIMENSION $x '' incremental-no-interpolation 1 1"
57 echo "CHART crsproxy.commands_failed '' 'CRS Failed Commands' 'replies/s' crsproxy '' stacked 20110 $update_every"
58 for x in $crsproxy_cmds
60 echo "DIMENSION $x '' incremental-no-interpolation 1 1"
68 # the first argument to this function is the microseconds since last update
69 # pass this parameter to the BEGIN statement (see bellow).
71 # do all the work to collect / calculate the values
73 # remember: KEEP IT SIMPLE AND SHORT
75 # get the values from crsproxy
76 eval "`wget 2>/dev/null -O - "$crsproxy_url" |\
77 sed -e "s/ \+/ /g" -e "s/\./_/g" -e "s/ = /=/g" -e "s/^/crsproxy_/g" |\
78 egrep "^crsproxy_[a-zA-Z][a-zA-Z0-9_]*=[0-9]+$"`"
81 # write the result of the work.
83 BEGIN crsproxy.connected $1
84 SET web = $((crsproxy_web_clients_opened - crsproxy_web_clients_closed))
85 SET native = $((crsproxy_crs_clients_opened - crsproxy_crs_clients_closed))
86 SET virtual = $((crsproxy_virtual_clients_opened - crsproxy_virtual_clients_closed))
88 BEGIN crsproxy.requests $1
89 SET web = $crsproxy_web_requests
90 SET native = $crsproxy_native_requests
92 BEGIN crsproxy.clients $1
93 SET web = $crsproxy_web_clients_opened
94 SET native = $crsproxy_crs_clients_opened
95 SET virtual = $crsproxy_virtual_clients_opened
97 BEGIN crsproxy.replies $1
98 SET ok = $crsproxy_replies_success
99 SET failed = $crsproxy_replies_error
101 BEGIN crsproxy.bconnections $1
102 SET ok = $crsproxy_connections_nonblocking_established
103 SET failed = $crsproxy_connections_nonblocking_failed
107 local native_requests="_native_requests"
108 local web_requests="_web_requests"
109 local replies_error="_replies_error"
112 echo "BEGIN crsproxy.commands $1"
113 for x in $crsproxy_cmds
115 eval "v=\$(( crsproxy_cmd_$x$native_requests + crsproxy_cmd_$x$web_requests ))"
120 echo "BEGIN crsproxy.commands_failed $1"
121 for x in $crsproxy_cmds
123 eval "v=\$crsproxy_cmd_$x$replies_error"