diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-08 07:30:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-08 07:30:37 +0000 |
commit | 8a7b72f7cd1ccd547a03eb4243294e741d661d3f (patch) | |
tree | 7bc7be4a8e9e298daa1349348400aa2a653866f2 /collectors/charts.d.plugin/squid | |
parent | New upstream version 1.11.1+dfsg (diff) | |
download | netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.tar.xz netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.zip |
Adding upstream version 1.12.0.upstream/1.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/charts.d.plugin/squid')
-rw-r--r-- | collectors/charts.d.plugin/squid/README.md | 9 | ||||
-rw-r--r-- | collectors/charts.d.plugin/squid/squid.chart.sh | 20 |
2 files changed, 12 insertions, 17 deletions
diff --git a/collectors/charts.d.plugin/squid/README.md b/collectors/charts.d.plugin/squid/README.md index 0934ccfc..cfb61790 100644 --- a/collectors/charts.d.plugin/squid/README.md +++ b/collectors/charts.d.plugin/squid/README.md @@ -1,9 +1,8 @@ -> THIS MODULE IS OBSOLETE. -> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT - - # squid +> THIS MODULE IS OBSOLETE. +> USE [THE PYTHON ONE](../../python.d.plugin/squid) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT + The plugin will monitor a squid server. It will produce 4 charts: @@ -64,3 +63,5 @@ squid_update_every=5 ``` --- + +[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fsquid%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]() diff --git a/collectors/charts.d.plugin/squid/squid.chart.sh b/collectors/charts.d.plugin/squid/squid.chart.sh index cf5d1d78..ebddb32c 100644 --- a/collectors/charts.d.plugin/squid/squid.chart.sh +++ b/collectors/charts.d.plugin/squid/squid.chart.sh @@ -25,13 +25,10 @@ squid_get_stats() { squid_autodetect() { local host="127.0.0.1" port url x - for port in 3128 8080 - do - for url in "cache_object://$host:$port/counters" "/squid-internal-mgr/counters" - do + for port in 3128 8080; do + for url in "cache_object://$host:$port/counters" "/squid-internal-mgr/counters"; do x=$(squid_get_stats_internal "$host" "$port" "$url" | grep client_http.requests) - if [ ! -z "$x" ] - then + if [ ! -z "$x" ]; then squid_host="$host" squid_port="$port" squid_url="$url" @@ -50,8 +47,7 @@ squid_check() { require_cmd sed || return 1 require_cmd egrep || return 1 - if [ -z "$squid_host" ] || [ -z "$squid_port" ] || [ -z "$squid_url" ] - then + if [ -z "$squid_host" ] || [ -z "$squid_port" ] || [ -z "$squid_url" ]; then squid_autodetect || return 1 fi @@ -59,8 +55,7 @@ squid_check() { local x x="$(squid_get_stats | grep client_http.requests)" # shellcheck disable=SC2181 - if [ ! $? -eq 0 ] || [ -z "$x" ] - then + if [ ! $? -eq 0 ] || [ -z "$x" ]; then error "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 @@ -93,7 +88,6 @@ EOF return 0 } - squid_update() { # the first argument to this function is the microseconds since last update # pass this parameter to the BEGIN statement (see bellow). @@ -114,8 +108,8 @@ squid_update() { # even if something goes wrong, no other code can be executed # shellcheck disable=SC1117 - eval "$(squid_get_stats |\ - sed -e "s/ \+/ /g" -e "s/\./_/g" -e "s/^\([a-z0-9_]\+\) *= *\([0-9]\+\)$/local squid_\1=\2/g" |\ + eval "$(squid_get_stats | + sed -e "s/ \+/ /g" -e "s/\./_/g" -e "s/^\([a-z0-9_]\+\) *= *\([0-9]\+\)$/local squid_\1=\2/g" | grep -E "^local squid_(client_http|server_all)_[a-z0-9_]+=[0-9]+$")" # write the result of the work. |