fix for interfaces with - in them
Costa Tsaousis (ktsaou) committed
Oct 22, 2013 at 12:32 UTC
1cc2001c1f8c94cf5cbe5726c6a012c6e2222949
3 files changed
+18
-8
example.html
+7
-2
@@ -32,8 +32,13 @@
32
drawChart('ppp0', 'ppp0_div', width, height, "ppp0.json", "Live Network Usage for ppp0");
33
}
34
35
- // EDIT: how often the charts are updated, in milliseconds
36
- setInterval(drawCharts, 1000);
35
+ function myRefresh() {
36
+ // refresh up to 4 charts every time
37
+ refreshCharts(4);
38
+ }
39
+
40
+ // EDIT: how often the charts are updated, in milliseconds
41
+ setInterval(myRefresh, 1000);
42
</script>
43
</head>
44
netdata.js
+2
-1
@@ -17,6 +17,7 @@
17
if(!jsonData || jsonData.length == 0) return;
18
19
// Create our data table out of JSON data loaded from server.
20
+ charts_data[index] = null;
21
charts_data[index] = new google.visualization.DataTable(jsonData);
22
23
// Instantiate and draw our chart, passing in some options.
@@ -87,7 +88,7 @@
88
var h = howmany;
89
if(h == 0) h = 1;
90
if(h > charts.length) h = charts.length;
90
- console.log('Will run for ' + h + ' charts');
91
+ //console.log('Will run for ' + h + ' charts');
92
93
var i;
94
for(i = 0; i < h; i++) {
netdata.start
+9
-5
@@ -39,7 +39,7 @@ fi
39
cat <<EOFHTACCESS >"${data}/.htaccess"
40
41
ExpiresActive on
42
-ExpiresDefault A0
42
+ExpiresDefault A0
43
ExpiresByType application/json A0
44
45
Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
@@ -47,6 +47,8 @@ Header set Pragma "no-cache"
47
48
EOFHTACCESS
49
50
+rm "${data}"/*.json
51
+
52
echo "Stopping a (possibly) running netdata..."
53
killall netdata 2>/dev/null
54
@@ -156,8 +158,9 @@ fi
158
159
for x in $all
160
do
159
- eval "NETDATA_TITLE_${x}=\${NETDATA_TITLE_${x}:-Live Network Usage for ${x}}"
160
- eval "t=\${NETDATA_TITLE_${x}}"
161
+ y=`echo "$x" | tr "-" "_"`
162
+ eval "NETDATA_TITLE_${y}=\${NETDATA_TITLE_${y}:-Live Network Usage for ${x}}"
163
+ eval "t=\${NETDATA_TITLE_${y}}"
164
cat >>all.html <<EOF2
165
drawChart('${x}', '${x}_div', width, height, "data/${x}.json", "${t}");
166
EOF2
@@ -198,8 +201,9 @@ EOF3
201
tmp="/tmp/$RANDOM.netdata.$$.$RANDOM"
202
for x in $all
203
do
201
- eval "NETDATA_PRIORITY_${x}=\${NETDATA_PRIORITY_${x}:-${x}}"
202
- eval "t=\${NETDATA_PRIORITY_${x}}"
204
+ y=`echo "$x" | tr "-" "_"`
205
+ eval "NETDATA_PRIORITY_${y}=\${NETDATA_PRIORITY_${y}:-${x}}"
206
+ eval "t=\${NETDATA_PRIORITY_${y}}"
207
echo "${t}.${x}"
208
done >"${tmp}"
209