diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-01-23 04:07:44 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-01-23 04:07:44 +0200 |
commit | 4f9402fe57bb1951c8ac8081c18f38a9cbdab598 (patch) | |
tree | e2fb4f35fb37a4e85d874325f418e1092b854103 | |
parent | cb632c1b06dc07648947b51de755550a8bef2d8e (diff) |
added apache mod_status monitoring
-rwxr-xr-x | plugins.d/charts.d.plugin | 32 | ||||
-rwxr-xr-x | web/index.html | 67 |
2 files changed, 99 insertions, 0 deletions
diff --git a/plugins.d/charts.d.plugin b/plugins.d/charts.d.plugin index dea216a829..43a96947a4 100755 --- a/plugins.d/charts.d.plugin +++ b/plugins.d/charts.d.plugin @@ -235,6 +235,38 @@ fixid() { tr "[A-Z]" "[a-z]" } +# convert any floating point number +# to integer, give a multiplier +# the result is stored in ${FLOAT2INT_RESULT} +# so that no fork is necessary +float2int() { + local f="$1" m="$2" a b l + + # echo >&2 "f='${f}', m='${m}'" + + # split the floating point number + # in integer (a) and decimal (b) + a=${f/.*/} + b=${f/*./} + + # the length of the multiplier + l=$[ ${#m} - 1 ] + + # cut the decimal part if it is + # longer than the multiplier + [ ${#b} -gt ${l} ] && b=${b:0:${l}} + b=$[10#$b] + + # prepend a zero to the integer + # part, if it is missing + [ -z "${a}" ] && a="0" + a=$[10#$a] + + # store the result + FLOAT2INT_RESULT=$[ (a * m) + b ] + # echo >&2 "FLOAT2INT_RESULT='${FLOAT2INT_RESULT}'" +} + # ----------------------------------------------------------------------------- # charts check functions diff --git a/web/index.html b/web/index.html index a2a43ae7e3..94d251abb4 100755 --- a/web/index.html +++ b/web/index.html @@ -1398,6 +1398,73 @@ function prepareScreen(data) { head += '</div>'; html += head + all; } + else if(t.name === 'apache') { + var head = '<div style="width: 100%; text-align: center;">'; + var all = ''; + $.each(t.charts, function(x, f) { + var c = 'null'; + switch(f.id) { + case 'apache.requests' : + head += '<div data-netdata="' + f.id + '"' + + ' data-chart-library="gauge"' + + ' data-title="Requests"' + + ' data-gauge-adjust="width"' + + ' data-width="12%"' + + ' data-before="0"' + + ' data-after="-' + duration.toString() + '"' + + ' data-points="' + duration.toString() + '"' + + ' data-colors="' + NETDATA.colors[0] + '"' + + ' role="application"></div>'; + break; + + case 'apache.net': + c = NETDATA.colors[1]; + head += '<div data-netdata="' + f.id + '"' + + ' data-chart-library="gauge"' + + ' data-title="Bandwidth"' + + ' data-gauge-adjust="width"' + + ' data-width="12%"' + + ' data-before="0"' + + ' data-after="-' + duration.toString() + '"' + + ' data-points="' + duration.toString() + '"' + + ' data-colors="' + c + '"' + + ' role="application"></div>'; + break; + + case 'apache.workers': + head += '<div data-netdata="' + f.id + '"' + + ' data-dimensions="busy"' + + ' data-append-options="percentage"' + + ' data-gauge-max-value="100"' + + ' data-chart-library="gauge"' + + ' data-title="Workers Utilization"' + + ' data-units="percentage %"' + + ' data-gauge-adjust="width"' + + ' data-width="12%"' + + ' data-before="0"' + + ' data-after="-' + duration.toString() + '"' + + ' data-points="' + duration.toString() + '"' + + ' data-colors="' + NETDATA.colors[2] + '"' + + ' role="application"></div>'; + break; + + case 'apache.bytesperreq': + c = NETDATA.colors[3]; + break; + } + + all += getMessage(f.id) + '<div data-netdata="' + f.id + '"' + + ' data-width="' + pcent_width.toString() + '%"' + + ' data-height="' + options.chartsHeight.toString() + 'px"' + + ' data-before="0"' + + ' data-after="-' + duration.toString() + '"' + + ' data-id="' + name2id(options.hostname + '/' + f.id) + '"' + + ' data-colors="' + c + '"' + + ' role="application"></div>'; + }); + head += '</div>'; + html += head + all; + } else { $.each(t.charts, function(x, f) { html += getMessage(f.id) + '<div data-netdata="' + f.id + '"' |