3 squid_url="http://127.0.0.1:8080/squid-internal-mgr/counters"
6 # check once if the url works
7 wget 2>/dev/null -O /dev/null "$squid_url"
10 echo >&2 "squid: cannot fetch the url: $squid_url. Please set squid_url='url' in $confd/squid.conf"
20 CHART squid.clients_net '' "Squid Client Bandwidth" "kilobits/s" squid '' area 20001 $update_every
21 DIMENSION client_http_kbytes_in in incremental 8 1
22 DIMENSION client_http_kbytes_out out incremental -8 1
23 DIMENSION client_http_hit_kbytes_out hits incremental -8 1
25 CHART squid.clients_requests '' "Squid Client Requests" "requests/s" squid '' line 20003 $update_every
26 DIMENSION client_http_requests requests incremental 1 1
27 DIMENSION client_http_hits hits incremental 1 1
28 DIMENSION client_http_errors errors incremental -1 1
30 CHART squid.servers_net '' "Squid Server Bandwidth" "kilobits/s" squid '' area 20002 $update_every
31 DIMENSION server_all_kbytes_in in incremental 8 1
32 DIMENSION server_all_kbytes_out out incremental -8 1
34 CHART squid.servers_requests '' "Squid Server Requests" "requests/s" squid '' line 20004 $update_every
35 DIMENSION server_all_requests requests incremental 1 1
36 DIMENSION server_all_errors errors incremental -1 1
44 # do all the work to collect / calculate the values
47 # get the values from squid
48 eval `wget 2>/dev/null -O - "$squid_url" | sed -e "s/\./_/g" -e "s/ = /=/g" | egrep "(^client_http_|^server_all_)"`
50 # write the result of the work.
52 BEGIN squid.clients_net
53 SET client_http_kbytes_in = $client_http_kbytes_in
54 SET client_http_kbytes_out = $client_http_kbytes_out
55 SET client_http_hit_kbytes_out = $client_http_hit_kbytes_out
58 BEGIN squid.clients_requests
59 SET client_http_requests = $client_http_requests
60 SET client_http_hits = $client_http_hits
61 SET client_http_errors = $client_http_errors
64 BEGIN squid.servers_net
65 SET server_all_kbytes_in = $server_all_kbytes_in
66 SET server_all_kbytes_out = $server_all_kbytes_out
69 BEGIN squid.servers_requests
70 SET server_all_requests = $server_all_requests
71 SET server_all_errors = $server_all_errors