3 <!--[if IE]><script type="text/javascript" src="<%=resource%>/livestats/ExCanvas.js"></script><![endif]-->
4 <script type="text/javascript" src="<%=resource%>/livestats/MochiKit.js"></script>
5 <script type="text/javascript" src="<%=resource%>/livestats/JsonRpc.js"></script>
6 <script type="text/javascript" src="<%=resource%>/livestats/PlotKit.js"></script>
7 <script type="text/javascript" src="<%=resource%>/livestats/GraphRPC.js"></script>
10 local interfaces = { }
11 local uci = luci.model.uci.cursor_state()
13 uci:foreach("network", "interface",
15 if s.ifname ~= "lo" then
16 table.insert( interfaces,
17 "'" .. ( s.ifname or s['.name'] ) .. "'"
24 <script type="text/javascript">
25 function initGraphs() {
26 var rpc = new GraphRPC(
27 document.getElementById('live_graphs'),
28 '<%=luci.dispatcher.build_url('rpc', 'sys')%>', 'net.deviceinfo',
32 [ "1", "received Bytes/s", "9", "transmitted Bytes/s" ],
34 // Graph layout options
35 { shouldFill: false, strokeColor: null,
36 strokeColorTransform: "asFillColor",
37 title: 'Traffic on interface "%s"',
38 separateDS: true, strokeWidth: 0.5, height: 140,
39 padding: { left: 70, right: 10, top: 10, bottom: 20 },
40 instances: [ <%=table.concat(interfaces, ", ") %> ] },
43 function(thisval, lastval) {
44 return ( ( thisval - lastval ) / 2 );
49 MochiKit.DOM.addLoadEvent(initGraphs);
52 <div id="live_graphs"></div>