diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-02-24 14:54:13 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-02-24 14:54:13 +0200 |
commit | 539947e1d9dd51c37dc2142f5626b885b9ef2e6c (patch) | |
tree | 0cb646b92f64b16a227abe26329b20ec54ad1700 /charts.d/squid.chart.sh | |
parent | 50a194f68c07aee6abdd9342fa97e3d4f4579f41 (diff) |
some squid installations need a completely different URL - support for custom url
Diffstat (limited to 'charts.d/squid.chart.sh')
-rwxr-xr-x | charts.d/squid.chart.sh | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/charts.d/squid.chart.sh b/charts.d/squid.chart.sh index cd7d7ea1f6..564ba4f212 100755 --- a/charts.d/squid.chart.sh +++ b/charts.d/squid.chart.sh @@ -1,14 +1,13 @@ #!/bin/sh squid_host="127.0.0.1" -squid_port="3128" -squid_path="squid-internal-mgr/counters" -squid_path2="counters" +squid_port="3127" +squid_url="cache_object://$squid_host:$squid_port/counters" squid_update_every=5 squid_get_stats() { nc $squid_host $squid_port <<EOF -GET cache_object://$squid_host:$squid_port/$squid_path HTTP/1.0 +GET $squid_url HTTP/1.0 EOF } @@ -18,13 +17,8 @@ squid_check() { local x=`squid_get_stats | grep client_http.requests` if [ ! $? -eq 0 -o -z "$x" ] then - squid_path="$squid_path2" - x=`squid_get_stats | grep client_http.requests` - if [ ! $? -eq 0 -o -z "$x" ] - then - 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" - return 1 - fi + 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" + return 1 fi return 0 |