@cryptotaxi247 / netdata-1 / commits / 539947e1d

some squid installations need a completely different URL - support for custom url

Costa Tsaousis (ktsaou) committed Feb 24, 2015 at 14:54 UTC 539947e1d9dd51c37dc2142f5626b885b9ef2e6c
1 file changed +5 -11
charts.d/squid.chart.sh
+5 -11
@@ -1,14 +1,13 @@
1 #!/bin/sh
2
3 squid_host="127.0.0.1"
4 -squid_port="3128"
5 -squid_path="squid-internal-mgr/counters"
6 -squid_path2="counters"
4 +squid_port="3127"
5 +squid_url="cache_object://$squid_host:$squid_port/counters"
6 squid_update_every=5
7
8 squid_get_stats() {
9 nc $squid_host $squid_port <<EOF
11 -GET cache_object://$squid_host:$squid_port/$squid_path HTTP/1.0
10 +GET $squid_url HTTP/1.0
11
12 EOF
13 }
@@ -18,13 +17,8 @@ squid_check() {
17 local x=`squid_get_stats | grep client_http.requests`
18 if [ ! $? -eq 0 -o -z "$x" ]
19 then
21 - squid_path="$squid_path2"
22 - x=`squid_get_stats | grep client_http.requests`
23 - if [ ! $? -eq 0 -o -z "$x" ]
24 - then
25 - echo >&2 "squid: cannot fetch the counters from $squid_host:$squid_port. Please set squid_host='host' and squid_port='port' in $confd/squid.conf"
26 - return 1
27 - fi
20 + echo >&2 "squid: cannot fetch URL '$squid_url' by connecting to $squid_host:$squid_port. Please set squid_url='url' and squid_host='host' and squid_port='port' in $confd/squid.conf"
21 + return 1
22 fi
23
24 return 0