added apache mod_status monitoring
Costa Tsaousis (ktsaou) committed
Jan 23, 2016 at 04:07 UTC
4f9402fe57bb1951c8ac8081c18f38a9cbdab598
2 files changed
+99
plugins.d/charts.d.plugin
+32
@@ -235,6 +235,38 @@ fixid() {
235
tr "[A-Z]" "[a-z]"
236
}
237
238
+# convert any floating point number
239
+# to integer, give a multiplier
240
+# the result is stored in ${FLOAT2INT_RESULT}
241
+# so that no fork is necessary
242
+float2int() {
243
+ local f="$1" m="$2" a b l
244
+
245
+ # echo >&2 "f='${f}', m='${m}'"
246
+
247
+ # split the floating point number
248
+ # in integer (a) and decimal (b)
249
+ a=${f/.*/}
250
+ b=${f/*./}
251
+
252
+ # the length of the multiplier
253
+ l=$[ ${#m} - 1 ]
254
+
255
+ # cut the decimal part if it is
256
+ # longer than the multiplier
257
+ [ ${#b} -gt ${l} ] && b=${b:0:${l}}
258
+ b=$[10#$b]
259
+
260
+ # prepend a zero to the integer
261
+ # part, if it is missing
262
+ [ -z "${a}" ] && a="0"
263
+ a=$[10#$a]
264
+
265
+ # store the result
266
+ FLOAT2INT_RESULT=$[ (a * m) + b ]
267
+ # echo >&2 "FLOAT2INT_RESULT='${FLOAT2INT_RESULT}'"
268
+}
269
+
270
271
# -----------------------------------------------------------------------------
272
# charts check functions
web/index.html
+67
@@ -1398,6 +1398,73 @@ function prepareScreen(data) {
1398
head += '</div>';
1399
html += head + all;
1400
}
1401
+ else if(t.name === 'apache') {
1402
+ var head = '<div style="width: 100%; text-align: center;">';
1403
+ var all = '';
1404
+ $.each(t.charts, function(x, f) {
1405
+ var c = 'null';
1406
+ switch(f.id) {
1407
+ case 'apache.requests' :
1408
+ head += '<div data-netdata="' + f.id + '"'
1409
+ + ' data-chart-library="gauge"'
1410
+ + ' data-title="Requests"'
1411
+ + ' data-gauge-adjust="width"'
1412
+ + ' data-width="12%"'
1413
+ + ' data-before="0"'
1414
+ + ' data-after="-' + duration.toString() + '"'
1415
+ + ' data-points="' + duration.toString() + '"'
1416
+ + ' data-colors="' + NETDATA.colors[0] + '"'
1417
+ + ' role="application"></div>';
1418
+ break;
1419
+
1420
+ case 'apache.net':
1421
+ c = NETDATA.colors[1];
1422
+ head += '<div data-netdata="' + f.id + '"'
1423
+ + ' data-chart-library="gauge"'
1424
+ + ' data-title="Bandwidth"'
1425
+ + ' data-gauge-adjust="width"'
1426
+ + ' data-width="12%"'
1427
+ + ' data-before="0"'
1428
+ + ' data-after="-' + duration.toString() + '"'
1429
+ + ' data-points="' + duration.toString() + '"'
1430
+ + ' data-colors="' + c + '"'
1431
+ + ' role="application"></div>';
1432
+ break;
1433
+
1434
+ case 'apache.workers':
1435
+ head += '<div data-netdata="' + f.id + '"'
1436
+ + ' data-dimensions="busy"'
1437
+ + ' data-append-options="percentage"'
1438
+ + ' data-gauge-max-value="100"'
1439
+ + ' data-chart-library="gauge"'
1440
+ + ' data-title="Workers Utilization"'
1441
+ + ' data-units="percentage %"'
1442
+ + ' data-gauge-adjust="width"'
1443
+ + ' data-width="12%"'
1444
+ + ' data-before="0"'
1445
+ + ' data-after="-' + duration.toString() + '"'
1446
+ + ' data-points="' + duration.toString() + '"'
1447
+ + ' data-colors="' + NETDATA.colors[2] + '"'
1448
+ + ' role="application"></div>';
1449
+ break;
1450
+
1451
+ case 'apache.bytesperreq':
1452
+ c = NETDATA.colors[3];
1453
+ break;
1454
+ }
1455
+
1456
+ all += getMessage(f.id) + '<div data-netdata="' + f.id + '"'
1457
+ + ' data-width="' + pcent_width.toString() + '%"'
1458
+ + ' data-height="' + options.chartsHeight.toString() + 'px"'
1459
+ + ' data-before="0"'
1460
+ + ' data-after="-' + duration.toString() + '"'
1461
+ + ' data-id="' + name2id(options.hostname + '/' + f.id) + '"'
1462
+ + ' data-colors="' + c + '"'
1463
+ + ' role="application"></div>';
1464
+ });
1465
+ head += '</div>';
1466
+ html += head + all;
1467
+ }
1468
else {
1469
$.each(t.charts, function(x, f) {
1470
html += getMessage(f.id) + '<div data-netdata="' + f.id + '"'