minor fixes
Costa Tsaousis (ktsaou) committed
May 4, 2014 at 15:53 UTC
65aa1943365878c081d92abfb586f70517bc673c
4 files changed
+71
-57
charts.d/mem_apps.chart.sh
+5
-11
@@ -23,17 +23,13 @@ mem_apps_bc_finalze=
23
24
mem_apps_create() {
25
26
- cat <<EOF1
27
-CHART system.apps '' "Apps Memory" "MB" "mem" "mem" stacked 20000 $update_every
28
-EOF1
26
+ echo "CHART apps.mem '' 'Apps Memory' MB apps apps stacked 20000 $update_every"
27
28
local x=
29
for x in $mem_apps_apps
30
do
31
+ echo "DIMENSION $x $x absolute 1 1024"
32
34
-cat <<EOF1
35
-DIMENSION $x $x absolute 1 1024
36
-EOF1
33
# this string is needed later in the update() function
34
# to finalize the instructions for the bc command
35
mem_apps_bc_finalze="$mem_apps_bc_finalze \"SET $x = \"; $x;"
@@ -41,15 +37,14 @@ EOF1
37
return 0
38
}
39
44
-mem_apps_egrep="(`echo "$mem_apps_apps" | sed -e "s/^ \+//g" -e "s/ \+$//g" -e "s/ /|/g"`)"
40
mem_apps_update() {
41
# do all the work to collect / calculate the values
42
# for each dimension
43
# remember: KEEP IT SIMPLE AND SHORT
44
50
- echo "BEGIN system.apps"
51
- ps -e -o comm,rss |\
52
- egrep "^$mem_apps_egrep " |\
45
+ echo "BEGIN apps.mem"
46
+ ps -o comm,rss -C "$mem_apps_apps" |\
47
+ grep -v "^COMMAND" |\
48
( sed -e "s/ \+/ /g" -e "s/ /+=/g";
49
echo "$mem_apps_bc_finalze"
50
) | bc
@@ -57,4 +52,3 @@ mem_apps_update() {
52
53
return 0
54
}
60
-
charts.d/squid.chart.sh
+8
-8
@@ -17,21 +17,21 @@ squid_check() {
17
squid_create() {
18
# create the charts
19
cat <<EOF
20
-CHART net.squid_clients '' "Squid Client Bandwidth" "kilobits/s" squid '' area 20001 $update_every
20
+CHART squid.clients_net '' "Squid Client Bandwidth" "kilobits/s" squid '' area 20001 $update_every
21
DIMENSION client_http_kbytes_in in incremental 8 1
22
DIMENSION client_http_kbytes_out out incremental -8 1
23
DIMENSION client_http_hit_kbytes_out hits incremental -8 1
24
25
-CHART squid.client_requests '' "Squid Client Requests" "requests/s" squid 'none' line 20003 $update_every
25
+CHART squid.clients_requests '' "Squid Client Requests" "requests/s" squid '' line 20003 $update_every
26
DIMENSION client_http_requests requests incremental 1 1
27
DIMENSION client_http_hits hits incremental 1 1
28
DIMENSION client_http_errors errors incremental -1 1
29
30
-CHART net.squid_servers '' "Squid Server Bandwidth" "kilobits/s" squid '' area 20002 $update_every
30
+CHART squid.servers_net '' "Squid Server Bandwidth" "kilobits/s" squid '' area 20002 $update_every
31
DIMENSION server_all_kbytes_in in incremental 8 1
32
DIMENSION server_all_kbytes_out out incremental -8 1
33
34
-CHART squid.server_requests '' "Squid Server Requests" "requests/s" squid 'none' line 20004 $update_every
34
+CHART squid.servers_requests '' "Squid Server Requests" "requests/s" squid '' line 20004 $update_every
35
DIMENSION server_all_requests requests incremental 1 1
36
DIMENSION server_all_errors errors incremental -1 1
37
EOF
@@ -49,24 +49,24 @@ squid_update() {
49
50
# write the result of the work.
51
cat <<VALUESEOF
52
-BEGIN net.squid_clients
52
+BEGIN squid.clients_net
53
SET client_http_kbytes_in = $client_http_kbytes_in
54
SET client_http_kbytes_out = $client_http_kbytes_out
55
SET client_http_hit_kbytes_out = $client_http_hit_kbytes_out
56
END
57
58
-BEGIN squid.client_requests
58
+BEGIN squid.clients_requests
59
SET client_http_requests = $client_http_requests
60
SET client_http_hits = $client_http_hits
61
SET client_http_errors = $client_http_errors
62
END
63
64
-BEGIN net.squid_servers
64
+BEGIN squid.servers_net
65
SET server_all_kbytes_in = $server_all_kbytes_in
66
SET server_all_kbytes_out = $server_all_kbytes_out
67
END
68
69
-BEGIN squid.server_requests
69
+BEGIN squid.servers_requests
70
SET server_all_requests = $server_all_requests
71
SET server_all_errors = $server_all_errors
72
END
web/index.js
+1
-12
@@ -896,7 +896,7 @@ function initCharts() {
896
}
897
898
if(j == categories.length) {
899
- categories.push({name: c.type, title: c.category, description: '', priority: 0, count: 1, glyphicon: c.glyphicon, html: h});
899
+ categories.push({name: c.type, title: c.category, description: '', priority: c.categoryPriority, count: 1, glyphicon: c.glyphicon, html: h});
900
}
901
}
902
});
@@ -904,17 +904,6 @@ function initCharts() {
904
document.getElementById('server_summary_id').innerHTML = "<small>NetData server at <b>" + all.hostname + "</b> is maintaining <b>" + mycharts.length + "</b> charts, having <b>" + dimensions + "</b> dimensions (by default with <b>" + all.history + "</b> entries each), which are updated every <b>" + all.update_every + "s</b>, using a total of <b>" + (Math.round(all.memory * 10 / 1024 / 1024) / 10) + " MB</b> for the round robin database.</small>";
905
906
$.each(categories, function(i, a) {
907
- if(a.name == "system") a.priority = 1;
908
- else if(a.name == "net") a.priority = 2;
909
- else if(a.name == "tc") a.priority = 3;
910
- else if(a.name == "conntrack") a.priority = 4;
911
- else if(a.name == "ipvs") a.priority = 5;
912
- else if(a.name == "ipv4") a.priority = 6;
913
- else if(a.name == "cpu") a.priority = 7;
914
- else if(a.name == "mem") a.priority = 8;
915
- else if(a.name == "disk") a.priority = 9;
916
- else a.priority = 99;
917
-
907
a.html = "<tr><td id=\"" + a.name + "\"><ol class=\"breadcrumb graphs\"><li class=\"active\"><span class=\"glyphicon " + a.glyphicon + "\"></span> <a id=\"" + a.name + "\" href=\"#" + a.name + "\"><b>" + a.title + "</b> " + a.description + " </a></li></ol></td></tr><tr><td><div class=\"thumbgraphs\">" + a.html + "</td></tr>";
908
});
909
web/netdata.js
+57
-26
@@ -285,6 +285,7 @@ function loadCharts(base_url, doNext) {
285
switch(json.charts[i].type) {
286
case "system":
287
json.charts[i].category = "System";
288
+ json.charts[i].categoryPriority = 10;
289
json.charts[i].glyphicon = "glyphicon-dashboard";
290
json.charts[i].group = 5;
291
@@ -298,66 +299,96 @@ function loadCharts(base_url, doNext) {
299
}
300
break;
301
301
- case "cpu":
302
- json.charts[i].category = "CPU";
303
- json.charts[i].glyphicon = "glyphicon-dashboard";
302
+ case "net":
303
+ json.charts[i].category = "Network";
304
+ json.charts[i].categoryPriority = 20;
305
+ json.charts[i].glyphicon = "glyphicon-transfer";
306
json.charts[i].group = 5;
307
306
- if(json.charts[i].id.substring(0, 7) == "cpu.cpu") {
307
- json.charts[i].chartOptions.vAxis.minValue = 0;
308
- json.charts[i].chartOptions.vAxis.maxValue = 100;
309
- }
310
- break;
311
-
312
- case "mem":
313
- json.charts[i].category = "Memory";
314
- json.charts[i].glyphicon = "glyphicon-dashboard";
315
- json.charts[i].group = 5;
308
+ // disable IFB and net.lo devices by default
309
+ if((json.charts[i].id.substring(json.charts[i].id.length - 4, json.charts[i].id.length) == "-ifb")
310
+ || json.charts[i].id == "net.lo")
311
+ json.charts[i].enabled = false;
312
break;
313
314
case "tc":
315
json.charts[i].category = "QoS";
316
+ json.charts[i].categoryPriority = 30;
317
json.charts[i].glyphicon = "glyphicon-random";
318
json.charts[i].group = 15;
319
break;
320
324
- case "net":
325
- json.charts[i].category = "Network";
326
- json.charts[i].glyphicon = "glyphicon-transfer";
321
+ case "ipvs":
322
+ json.charts[i].category = "IPVS";
323
+ json.charts[i].categoryPriority = 40;
324
+ json.charts[i].glyphicon = "glyphicon-sort";
325
json.charts[i].group = 5;
326
+ break;
327
329
- // disable IFB and net.lo devices by default
330
- if((json.charts[i].id.substring(json.charts[i].id.length - 4, json.charts[i].id.length) == "-ifb")
331
- || json.charts[i].id == "net.lo")
332
- json.charts[i].enabled = false;
328
+ case "conntrack":
329
+ json.charts[i].category = "Netfilter";
330
+ json.charts[i].categoryPriority = 50;
331
+ json.charts[i].glyphicon = "glyphicon-cloud";
332
+ json.charts[i].group = 5;
333
break;
334
335
case "ipv4":
336
json.charts[i].category = "IPv4";
337
+ json.charts[i].categoryPriority = 60;
338
json.charts[i].glyphicon = "glyphicon-globe";
339
json.charts[i].group = 5;
340
break;
341
341
- case "conntrack":
342
- json.charts[i].category = "Netfilter";
343
- json.charts[i].glyphicon = "glyphicon-cloud";
342
+ case "mem":
343
+ json.charts[i].category = "Memory";
344
+ json.charts[i].categoryPriority = 70;
345
+ json.charts[i].glyphicon = "glyphicon-dashboard";
346
json.charts[i].group = 5;
347
break;
348
347
- case "ipvs":
348
- json.charts[i].category = "IPVS";
349
- json.charts[i].glyphicon = "glyphicon-sort";
349
+ case "cpu":
350
+ json.charts[i].category = "CPU";
351
+ json.charts[i].categoryPriority = 80;
352
+ json.charts[i].glyphicon = "glyphicon-dashboard";
353
json.charts[i].group = 5;
354
+
355
+ if(json.charts[i].id.substring(0, 7) == "cpu.cpu") {
356
+ json.charts[i].chartOptions.vAxis.minValue = 0;
357
+ json.charts[i].chartOptions.vAxis.maxValue = 100;
358
+ }
359
break;
360
361
case "disk":
362
json.charts[i].category = "Disks";
363
+ json.charts[i].categoryPriority = 90;
364
json.charts[i].glyphicon = "glyphicon-hdd";
365
json.charts[i].group = 5;
366
break;
367
368
+ case "apps":
369
+ json.charts[i].category = "Apps";
370
+ json.charts[i].categoryPriority = 4000;
371
+ json.charts[i].glyphicon = "glyphicon-globe";
372
+ json.charts[i].group = 5;
373
+ break;
374
+
375
+ case "squid":
376
+ json.charts[i].category = "Squid";
377
+ json.charts[i].categoryPriority = 5000;
378
+ json.charts[i].glyphicon = "glyphicon-globe";
379
+ json.charts[i].group = 5;
380
+ break;
381
+
382
+ case "example":
383
+ json.charts[i].category = "Examples";
384
+ json.charts[i].categoryPriority = 9000;
385
+ json.charts[i].glyphicon = "glyphicon-search";
386
+ json.charts[i].group = 5;
387
+ break;
388
+
389
default:
390
json.charts[i].category = json.charts[i].type;
391
+ json.charts[i].categoryPriority = 1000;
392
json.charts[i].glyphicon = "glyphicon-search";
393
json.charts[i].group = 5;
394
break;