diff options
author | Simon Nagl <simonnagl@aim.com> | 2016-04-28 22:41:15 +0200 |
---|---|---|
committer | Simon Nagl <simonnagl@aim.com> | 2016-04-29 02:31:15 +0200 |
commit | ec28e63c30962818dab315d64ee4da10005e47fd (patch) | |
tree | e4697d0be4d11c27726366b97351fa378722a3f4 /charts.d/apache.chart.sh | |
parent | 444aab651daab58c4e727fffe74ea21bc920cdab (diff) |
Fix #282 use modern arithmetic expansion in shell
Use $((.*)) instead of $[.*]
The later one is old syntax
Diffstat (limited to 'charts.d/apache.chart.sh')
-rwxr-xr-x | charts.d/apache.chart.sh | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/charts.d/apache.chart.sh b/charts.d/apache.chart.sh index c0fd3dc30f..dbf14a4327 100755 --- a/charts.d/apache.chart.sh +++ b/charts.d/apache.chart.sh @@ -47,21 +47,21 @@ apache_detect() { for x in "${@}" do case "${x}" in - 'Total Accesses') apache_key_accesses=$[i + 1] ;; - 'Total kBytes') apache_key_kbytes=$[i + 1] ;; - 'ReqPerSec') apache_key_reqpersec=$[i + 1] ;; - 'BytesPerSec') apache_key_bytespersec=$[i + 1] ;; - 'BytesPerReq') apache_key_bytesperreq=$[i + 1] ;; - 'BusyWorkers') apache_key_busyworkers=$[i + 1] ;; - 'IdleWorkers') apache_key_idleworkers=$[i + 1];; - 'ConnsTotal') apache_key_connstotal=$[i + 1] ;; - 'ConnsAsyncWriting') apache_key_connsasyncwriting=$[i + 1] ;; - 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$[i + 1] ;; - 'ConnsAsyncClosing') apache_key_connsasyncclosing=$[i + 1] ;; - 'Scoreboard') apache_key_scoreboard=$[i] ;; + 'Total Accesses') apache_key_accesses=$((i + 1)) ;; + 'Total kBytes') apache_key_kbytes=$((i + 1)) ;; + 'ReqPerSec') apache_key_reqpersec=$((i + 1)) ;; + 'BytesPerSec') apache_key_bytespersec=$((i + 1)) ;; + 'BytesPerReq') apache_key_bytesperreq=$((i + 1)) ;; + 'BusyWorkers') apache_key_busyworkers=$((i + 1)) ;; + 'IdleWorkers') apache_key_idleworkers=$((i + 1));; + 'ConnsTotal') apache_key_connstotal=$((i + 1)) ;; + 'ConnsAsyncWriting') apache_key_connsasyncwriting=$((i + 1)) ;; + 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$((i + 1)) ;; + 'ConnsAsyncClosing') apache_key_connsasyncclosing=$((i + 1)) ;; + 'Scoreboard') apache_key_scoreboard=$((i)) ;; esac - i=$[i + 1] + i=$((i + 1)) done # we will not check of the Conns* @@ -167,27 +167,27 @@ apache_check() { # _create is called once, to create the charts apache_create() { cat <<EOF -CHART apache.bytesperreq '' "apache Lifetime Avg. Response Size" "bytes/request" statistics apache.bytesperreq area $[apache_priority + 8] $apache_update_every +CHART apache.bytesperreq '' "apache Lifetime Avg. Response Size" "bytes/request" statistics apache.bytesperreq area $((apache_priority + 8)) $apache_update_every DIMENSION size '' absolute 1 ${apache_decimal_detail} -CHART apache.workers '' "apache Workers" "workers" workers apache.workers stacked $[apache_priority + 5] $apache_update_every +CHART apache.workers '' "apache Workers" "workers" workers apache.workers stacked $((apache_priority + 5)) $apache_update_every DIMENSION idle '' absolute 1 1 DIMENSION busy '' absolute 1 1 -CHART apache.reqpersec '' "apache Lifetime Avg. Requests/s" "requests/s" statistics apache.reqpersec line $[apache_priority + 6] $apache_update_every +CHART apache.reqpersec '' "apache Lifetime Avg. Requests/s" "requests/s" statistics apache.reqpersec line $((apache_priority + 6)) $apache_update_every DIMENSION requests '' absolute 1 ${apache_decimal_detail} -CHART apache.bytespersec '' "apache Lifetime Avg. Bandwidth/s" "kilobits/s" statistics apache.bytespersec area $[apache_priority + 7] $apache_update_every -DIMENSION sent '' absolute 8 $[apache_decimal_detail * 1000] -CHART apache.requests '' "apache Requests" "requests/s" requests apache.requests line $[apache_priority + 1] $apache_update_every +CHART apache.bytespersec '' "apache Lifetime Avg. Bandwidth/s" "kilobits/s" statistics apache.bytespersec area $((apache_priority + 7)) $apache_update_every +DIMENSION sent '' absolute 8 $((apache_decimal_detail * 1000)) +CHART apache.requests '' "apache Requests" "requests/s" requests apache.requests line $((apache_priority + 1)) $apache_update_every DIMENSION requests '' incremental 1 1 -CHART apache.net '' "apache Bandwidth" "kilobits/s" bandwidth apache.net area $[apache_priority + 3] $apache_update_every +CHART apache.net '' "apache Bandwidth" "kilobits/s" bandwidth apache.net area $((apache_priority + 3)) $apache_update_every DIMENSION sent '' incremental 8 1 EOF if [ ${apache_has_conns} -eq 1 ] then cat <<EOF2 -CHART apache.connections '' "apache Connections" "connections" connections apache.connections line $[apache_priority + 2] $apache_update_every +CHART apache.connections '' "apache Connections" "connections" connections apache.connections line $((apache_priority + 2)) $apache_update_every DIMENSION connections '' absolute 1 1 -CHART apache.conns_async '' "apache Async Connections" "connections" connections apache.conns_async stacked $[apache_priority + 4] $apache_update_every +CHART apache.conns_async '' "apache Async Connections" "connections" connections apache.conns_async stacked $((apache_priority + 4)) $apache_update_every DIMENSION keepalive '' absolute 1 1 DIMENSION closing '' absolute 1 1 DIMENSION writing '' absolute 1 1 @@ -212,23 +212,23 @@ apache_update() { # write the result of the work. cat <<VALUESEOF BEGIN apache.requests $1 -SET requests = $[apache_accesses] +SET requests = $((apache_accesses)) END BEGIN apache.net $1 -SET sent = $[apache_kbytes] +SET sent = $((apache_kbytes)) END BEGIN apache.reqpersec $1 -SET requests = $[apache_reqpersec] +SET requests = $((apache_reqpersec)) END BEGIN apache.bytespersec $1 -SET sent = $[apache_bytespersec] +SET sent = $((apache_bytespersec)) END BEGIN apache.bytesperreq $1 -SET size = $[apache_bytesperreq] +SET size = $((apache_bytesperreq)) END BEGIN apache.workers $1 -SET idle = $[apache_idleworkers] -SET busy = $[apache_busyworkers] +SET idle = $((apache_idleworkers)) +SET busy = $((apache_busyworkers)) END VALUESEOF @@ -236,12 +236,12 @@ VALUESEOF then cat <<VALUESEOF2 BEGIN apache.connections $1 -SET connections = $[apache_connstotal] +SET connections = $((apache_connstotal)) END BEGIN apache.conns_async $1 -SET keepalive = $[apache_connsasynckeepalive] -SET closing = $[apache_connsasyncwriting] -SET writing = $[apache_connsasyncwriting] +SET keepalive = $((apache_connsasynckeepalive)) +SET closing = $((apache_connsasyncwriting)) +SET writing = $((apache_connsasyncwriting)) END VALUESEOF2 fi |