]> arthur.barton.de Git - netdata.git/commitdiff
minor fixes
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 4 May 2014 12:53:24 +0000 (15:53 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 4 May 2014 12:53:24 +0000 (15:53 +0300)
charts.d/mem_apps.chart.sh
charts.d/squid.chart.sh
web/index.js
web/netdata.js

index cd04672165a1139fda8286e806b9747ebcc485ab..75618d748ea17ceea76fe62d3568c9a56f5b3724 100755 (executable)
@@ -23,17 +23,13 @@ mem_apps_bc_finalze=
 
 mem_apps_create() {
 
-       cat <<EOF1
-CHART system.apps '' "Apps Memory" "MB" "mem" "mem" stacked 20000 $update_every
-EOF1
+       echo "CHART apps.mem '' 'Apps Memory' MB apps apps stacked 20000 $update_every"
 
        local x=
        for x in $mem_apps_apps
        do
+               echo "DIMENSION $x $x absolute 1 1024"
 
-cat <<EOF1
-DIMENSION $x $x absolute 1 1024
-EOF1
                # this string is needed later in the update() function
                # to finalize the instructions for the bc command
                mem_apps_bc_finalze="$mem_apps_bc_finalze \"SET $x = \"; $x;"
@@ -41,15 +37,14 @@ EOF1
        return 0
 }
 
-mem_apps_egrep="(`echo "$mem_apps_apps" | sed -e "s/^ \+//g" -e "s/ \+$//g" -e "s/ /|/g"`)"
 mem_apps_update() {
        # do all the work to collect / calculate the values
        # for each dimension
        # remember: KEEP IT SIMPLE AND SHORT
 
-       echo "BEGIN system.apps"
-       ps -e -o comm,rss |\
-               egrep "^$mem_apps_egrep " |\
+       echo "BEGIN apps.mem"
+       ps -o comm,rss -C "$mem_apps_apps" |\
+               grep -v "^COMMAND" |\
                (       sed -e "s/ \+/ /g" -e "s/ /+=/g";
                        echo "$mem_apps_bc_finalze"
                ) | bc
@@ -57,4 +52,3 @@ mem_apps_update() {
 
        return 0
 }
-
index ff584c1a974f6d6ae69f9a497e3f09bbc0fa489a..774187a821fd35881c2adba44de19cb7e04dc171 100755 (executable)
@@ -17,21 +17,21 @@ squid_check() {
 squid_create() {
        # create the charts
        cat <<EOF
-CHART net.squid_clients '' "Squid Client Bandwidth" "kilobits/s" squid '' area 20001 $update_every
+CHART squid.clients_net '' "Squid Client Bandwidth" "kilobits/s" squid '' area 20001 $update_every
 DIMENSION client_http_kbytes_in in incremental 8 1
 DIMENSION client_http_kbytes_out out incremental -8 1
 DIMENSION client_http_hit_kbytes_out hits incremental -8 1
 
-CHART squid.client_requests '' "Squid Client Requests" "requests/s" squid 'none' line 20003 $update_every
+CHART squid.clients_requests '' "Squid Client Requests" "requests/s" squid '' line 20003 $update_every
 DIMENSION client_http_requests requests incremental 1 1
 DIMENSION client_http_hits hits incremental 1 1
 DIMENSION client_http_errors errors incremental -1 1
 
-CHART net.squid_servers '' "Squid Server Bandwidth" "kilobits/s" squid '' area 20002 $update_every
+CHART squid.servers_net '' "Squid Server Bandwidth" "kilobits/s" squid '' area 20002 $update_every
 DIMENSION server_all_kbytes_in in incremental 8 1
 DIMENSION server_all_kbytes_out out incremental -8 1
 
-CHART squid.server_requests '' "Squid Server Requests" "requests/s" squid 'none' line 20004 $update_every
+CHART squid.servers_requests '' "Squid Server Requests" "requests/s" squid '' line 20004 $update_every
 DIMENSION server_all_requests requests incremental 1 1
 DIMENSION server_all_errors errors incremental -1 1
 EOF
@@ -49,24 +49,24 @@ squid_update() {
 
        # write the result of the work.
        cat <<VALUESEOF
-BEGIN net.squid_clients
+BEGIN squid.clients_net
 SET client_http_kbytes_in = $client_http_kbytes_in
 SET client_http_kbytes_out = $client_http_kbytes_out
 SET client_http_hit_kbytes_out = $client_http_hit_kbytes_out
 END
 
-BEGIN squid.client_requests
+BEGIN squid.clients_requests
 SET client_http_requests = $client_http_requests
 SET client_http_hits = $client_http_hits
 SET client_http_errors = $client_http_errors
 END
 
-BEGIN net.squid_servers
+BEGIN squid.servers_net
 SET server_all_kbytes_in = $server_all_kbytes_in
 SET server_all_kbytes_out = $server_all_kbytes_out
 END
 
-BEGIN squid.server_requests
+BEGIN squid.servers_requests
 SET server_all_requests = $server_all_requests
 SET server_all_errors = $server_all_errors
 END
index 7c3a74d7bd3c19a5afbe5040c7782c7f2989b77c..caa28a542e7fdb01150ba3026cc0ec19ec35e05e 100644 (file)
@@ -896,7 +896,7 @@ function initCharts() {
                                }\r
 \r
                                if(j == categories.length) {\r
-                                       categories.push({name: c.type, title: c.category, description: '', priority: 0, count: 1, glyphicon: c.glyphicon, html: h});\r
+                                       categories.push({name: c.type, title: c.category, description: '', priority: c.categoryPriority, count: 1, glyphicon: c.glyphicon, html: h});\r
                                }\r
                        }\r
                });\r
@@ -904,17 +904,6 @@ function initCharts() {
                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>";\r
 \r
                $.each(categories, function(i, a) {\r
-                            if(a.name == "system") a.priority = 1;\r
-                       else if(a.name == "net") a.priority = 2;\r
-                       else if(a.name == "tc") a.priority = 3;\r
-                       else if(a.name == "conntrack") a.priority = 4;\r
-                       else if(a.name == "ipvs") a.priority = 5;\r
-                       else if(a.name == "ipv4") a.priority = 6;\r
-                       else if(a.name == "cpu") a.priority = 7;\r
-                       else if(a.name == "mem") a.priority = 8;\r
-                       else if(a.name == "disk") a.priority = 9;\r
-                       else a.priority = 99;\r
-\r
                        a.html = "<tr><td id=\"" + a.name + "\"><ol class=\"breadcrumb graphs\"><li class=\"active\"><span class=\"glyphicon " + a.glyphicon + "\"></span> &nbsp; <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>";\r
                });\r
 \r
index df5dcc4cfaa9f512aae59d1f948c716fc5b6974e..25947903e05818df361d3db1e319f9d8686235c9 100644 (file)
@@ -285,6 +285,7 @@ function loadCharts(base_url, doNext) {
                        switch(json.charts[i].type) {
                                case "system":
                                        json.charts[i].category = "System";
+                                       json.charts[i].categoryPriority = 10;
                                        json.charts[i].glyphicon = "glyphicon-dashboard";
                                        json.charts[i].group = 5;
 
@@ -298,66 +299,96 @@ function loadCharts(base_url, doNext) {
                                        }
                                        break;
 
-                               case "cpu":
-                                       json.charts[i].category = "CPU";
-                                       json.charts[i].glyphicon = "glyphicon-dashboard";
+                               case "net":
+                                       json.charts[i].category = "Network";
+                                       json.charts[i].categoryPriority = 20;
+                                       json.charts[i].glyphicon = "glyphicon-transfer";
                                        json.charts[i].group = 5;
 
-                                       if(json.charts[i].id.substring(0, 7) == "cpu.cpu") {
-                                               json.charts[i].chartOptions.vAxis.minValue = 0;
-                                               json.charts[i].chartOptions.vAxis.maxValue = 100;
-                                       }
-                                       break;
-
-                               case "mem":
-                                       json.charts[i].category = "Memory";
-                                       json.charts[i].glyphicon = "glyphicon-dashboard";
-                                       json.charts[i].group = 5;
+                                       // disable IFB and net.lo devices by default
+                                       if((json.charts[i].id.substring(json.charts[i].id.length - 4, json.charts[i].id.length) == "-ifb")
+                                               || json.charts[i].id == "net.lo")
+                                               json.charts[i].enabled = false;
                                        break;
 
                                case "tc":
                                        json.charts[i].category = "QoS";
+                                       json.charts[i].categoryPriority = 30;
                                        json.charts[i].glyphicon = "glyphicon-random";
                                        json.charts[i].group = 15;
                                        break;
 
-                               case "net":
-                                       json.charts[i].category = "Network";
-                                       json.charts[i].glyphicon = "glyphicon-transfer";
+                               case "ipvs":
+                                       json.charts[i].category = "IPVS";
+                                       json.charts[i].categoryPriority = 40;
+                                       json.charts[i].glyphicon = "glyphicon-sort";
                                        json.charts[i].group = 5;
+                                       break;
 
-                                       // disable IFB and net.lo devices by default
-                                       if((json.charts[i].id.substring(json.charts[i].id.length - 4, json.charts[i].id.length) == "-ifb")
-                                               || json.charts[i].id == "net.lo")
-                                               json.charts[i].enabled = false;
+                               case "conntrack":
+                                       json.charts[i].category = "Netfilter";
+                                       json.charts[i].categoryPriority = 50;
+                                       json.charts[i].glyphicon = "glyphicon-cloud";
+                                       json.charts[i].group = 5;
                                        break;
 
                                case "ipv4":
                                        json.charts[i].category = "IPv4";
+                                       json.charts[i].categoryPriority = 60;
                                        json.charts[i].glyphicon = "glyphicon-globe";
                                        json.charts[i].group = 5;
                                        break;
 
-                               case "conntrack":
-                                       json.charts[i].category = "Netfilter";
-                                       json.charts[i].glyphicon = "glyphicon-cloud";
+                               case "mem":
+                                       json.charts[i].category = "Memory";
+                                       json.charts[i].categoryPriority = 70;
+                                       json.charts[i].glyphicon = "glyphicon-dashboard";
                                        json.charts[i].group = 5;
                                        break;
 
-                               case "ipvs":
-                                       json.charts[i].category = "IPVS";
-                                       json.charts[i].glyphicon = "glyphicon-sort";
+                               case "cpu":
+                                       json.charts[i].category = "CPU";
+                                       json.charts[i].categoryPriority = 80;
+                                       json.charts[i].glyphicon = "glyphicon-dashboard";
                                        json.charts[i].group = 5;
+
+                                       if(json.charts[i].id.substring(0, 7) == "cpu.cpu") {
+                                               json.charts[i].chartOptions.vAxis.minValue = 0;
+                                               json.charts[i].chartOptions.vAxis.maxValue = 100;
+                                       }
                                        break;
 
                                case "disk":
                                        json.charts[i].category = "Disks";
+                                       json.charts[i].categoryPriority = 90;
                                        json.charts[i].glyphicon = "glyphicon-hdd";
                                        json.charts[i].group = 5;
                                        break;
 
+                               case "apps":
+                                       json.charts[i].category = "Apps";
+                                       json.charts[i].categoryPriority = 4000;
+                                       json.charts[i].glyphicon = "glyphicon-globe";
+                                       json.charts[i].group = 5;
+                                       break;
+
+                               case "squid":
+                                       json.charts[i].category = "Squid";
+                                       json.charts[i].categoryPriority = 5000;
+                                       json.charts[i].glyphicon = "glyphicon-globe";
+                                       json.charts[i].group = 5;
+                                       break;
+
+                               case "example":
+                                       json.charts[i].category = "Examples";
+                                       json.charts[i].categoryPriority = 9000;
+                                       json.charts[i].glyphicon = "glyphicon-search";
+                                       json.charts[i].group = 5;
+                                       break;
+
                                default:
                                        json.charts[i].category = json.charts[i].type;
+                                       json.charts[i].categoryPriority = 1000;
                                        json.charts[i].glyphicon = "glyphicon-search";
                                        json.charts[i].group = 5;
                                        break;