<%# Copyright 2010 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> <%- local fs = require "nixio.fs" local sys = require "luci.sys" local utl = require "luci.util" local param = luci.http.formvalue local iface = param("iface") local style = param("style") style = (style and #style > 0) and style or "s" -- -- render image -- if iface then luci.http.prepare_content("image/png") local png = io.popen("vnstati -i %s -%s -o -" %{ utl.shellquote(iface), utl.shellquote(style) }) luci.http.write(png:read("*a")) png:close() return -- -- update database -- else sys.call("vnstat -u >/dev/null 2>/dev/null") end -%> <%+header%>

<%:VnStat Graphs%>




<% for _, iface in ipairs(sys.net.devices()) do if iface ~= "lo" and not iface:match("^sit.*") and not iface:match("^if.*") and not iface:match("^teql.*") and not iface:match("^tun.*") then empty = false %>

<% end end %> <% if empty then %>

<%:No database has been set up yet. Go to the VnStat configuration and enable monitoring for one or more interfaces.%>

<% end %>
<%+footer%>