]> arthur.barton.de Git - netdata.git/blobdiff - charts.d/apache.chart.sh
updated shebang for compatibility
[netdata.git] / charts.d / apache.chart.sh
index dbf14a43274ba1408c3da12d81220bc498f0f667..837d752d26a87d3033afca28461c94347c5f6055 100755 (executable)
@@ -1,7 +1,8 @@
-#!/bin/bash
+# no need for shebang - this file is loaded from charts.d.plugin
 
 # the URL to download apache status info
 apache_url="http://127.0.0.1:80/server-status?auto"
+apache_curl_opts=
 
 # _update_every is a special variable - it holds the number of seconds
 # between the calls of the _update() function
@@ -66,19 +67,14 @@ apache_detect() {
 
        # we will not check of the Conns*
        # keys, since these are apache 2.4 specific
-       if [ -z "${apache_key_accesses}" \
-               -o -z "${apache_key_kbytes}" \
-               -o -z "${apache_key_reqpersec}" \
-               -o -z "${apache_key_bytespersec}" \
-               -o -z "${apache_key_bytesperreq}" \
-               -o -z "${apache_key_busyworkers}" \
-               -o -z "${apache_key_idleworkers}" \
-               -o -z "${apache_key_scoreboard}" \
-               ]
-               then
-               echo >&2 "apache: Invalid response or missing keys from apache server: ${*}"
-               return 1
-       fi
+       [ -z "${apache_key_accesses}"    ] && echo >&2 "apache: missing 'Total Accesses' from apache server: ${*}" && return 1
+       [ -z "${apache_key_kbytes}"      ] && echo >&2 "apache: missing 'Total kBytes' from apache server: ${*}" && return 1
+       [ -z "${apache_key_reqpersec}"   ] && echo >&2 "apache: missing 'ReqPerSec' from apache server: ${*}" && return 1
+       [ -z "${apache_key_bytespersec}" ] && echo >&2 "apache: missing 'BytesPerSec' from apache server: ${*}" && return 1
+       [ -z "${apache_key_bytesperreq}" ] && echo >&2 "apache: missing 'BytesPerReq' from apache server: ${*}" && return 1
+       [ -z "${apache_key_busyworkers}" ] && echo >&2 "apache: missing 'BusyWorkers' from apache server: ${*}" && return 1
+       [ -z "${apache_key_idleworkers}" ] && echo >&2 "apache: missing 'IdleWorkers' from apache server: ${*}" && return 1
+       [ -z "${apache_key_scoreboard}"  ] && echo >&2 "apache: missing 'Scoreboard' from apache server: ${*}" && return 1
 
        if [ ! -z "${apache_key_connstotal}" \
                -a ! -z "${apache_key_connsasyncwriting}" \
@@ -87,6 +83,8 @@ apache_detect() {
                ]
                then
                apache_has_conns=1
+       else
+               apache_has_conns=0
        fi
 
        return 0
@@ -94,7 +92,7 @@ apache_detect() {
 
 apache_get() {
        local oIFS="${IFS}" ret
-       IFS=$':\n' apache_response=($(curl -Ss "${apache_url}"))
+       IFS=$':\n' apache_response=($(curl -Ss ${apache_curl_opts} "${apache_url}"))
        ret=$?
        IFS="${oIFS}"
 
@@ -240,7 +238,7 @@ SET connections = $((apache_connstotal))
 END
 BEGIN apache.conns_async $1
 SET keepalive = $((apache_connsasynckeepalive))
-SET closing = $((apache_connsasyncwriting))
+SET closing = $((apache_connsasyncclosing))
 SET writing = $((apache_connsasyncwriting))
 END
 VALUESEOF2