* ffluci/statistics: port statistics to new controller api, add mysel to NOTICE

This commit is contained in:
Jo-Philipp Wich 2008-05-23 19:23:06 +00:00
parent 83a1263e90
commit eaa763cbdb
26 changed files with 155 additions and 34 deletions

5
NOTICE
View file

@ -2,4 +2,7 @@ FFLuCI - Freifunk Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0.
-- Contributors: please add your own notice here
-- Contributors: please add your own notice here
Luci-Statistics - Statistics for FFLuCI
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0.

View file

@ -1 +0,0 @@
module("ffluci.controller.admin.statistics", package.seeall)

View file

@ -0,0 +1,88 @@
--[[
Luci controller for statistics
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
$Id$
]]--
module("ffluci.controller.luci_statistics.luci_statistics", package.seeall)
fs = require("ffluci.fs")
tpl = require("ffluci.template")
function _entry( path, ... )
if fs.isfile( "/usr/lib/collectd/" .. path[4] .. ".so" ) then
entry( path, ... )
end
end
function index()
entry({"admin", "statistics"}, statistics_index, "Statistiken", 80)
entry({"admin", "statistics", "collectd"}, cbi("luci_statistics/collectd"), "Collectd", 10)
entry({"admin", "statistics", "output"}, statistics_outputplugins, "Ausgabeplugins", 20)
_entry({"admin", "statistics", "output", "rrdtool"}, cbi("luci_statistics/rrdtool"), "RRDTool", 10)
_entry({"admin", "statistics", "output", "network"}, cbi("luci_statistics/network"), "Netzwerk", 20)
_entry({"admin", "statistics", "output", "unixsock"}, cbi("luci_statistics/unixsock"), "Unix Socket", 30)
_entry({"admin", "statistics", "output", "csv"}, cbi("luci_statistics/csv"), "CSV", 40)
entry({"admin", "statistics", "system"}, statistics_systemplugins, "Systemplugins", 30)
_entry({"admin", "statistics", "system", "exec"}, cbi("luci_statistics/exec"), "Exec", 10)
_entry({"admin", "statistics", "system", "email"}, cbi("luci_statistics/email"), "E-Mail", 20)
_entry({"admin", "statistics", "system", "df"}, cbi("luci_statistics/df"), "Speicherplatz", 30)
_entry({"admin", "statistics", "system", "disk"}, cbi("luci_statistics/disk"), "Datenträger", 40)
_entry({"admin", "statistics", "system", "irq"}, cbi("luci_statistics/irq"), "Interrupts", 50)
_entry({"admin", "statistics", "system", "processes"}, cbi("luci_statistics/processes"), "Prozesse", 60)
entry({"admin", "statistics", "network"}, statistics_networkplugins, "Netzwerkplugins", 40)
_entry({"admin", "statistics", "network", "interface"}, cbi("luci_statistics/interface"), "Schnittstellen", 10)
_entry({"admin", "statistics", "network", "netlink"}, cbi("luci_statistics/netlink"), "Netlink", 20)
_entry({"admin", "statistics", "network", "iptables"}, cbi("luci_statistics/iptables"), "Firewall", 30)
_entry({"admin", "statistics", "network", "tcpconns"}, cbi("luci_statistics/tcpconns"), "Verbindungen", 40)
_entry({"admin", "statistics", "network", "ping"}, cbi("luci_statistics/ping"), "Ping", 50)
_entry({"admin", "statistics", "network", "dns"}, cbi("luci_statistics/dns"), "DNS", 60)
end
function statistics_index()
tpl.render("admin_statistics/index")
end
function statistics_outputplugins()
plugins = {
rrdtool="RRDTool",
network="Netzwerk",
unixsock="Unix Socket",
csv="CSV"
}
tpl.render("admin_statistics/outputplugins", {plugins=plugins})
end
function statistics_systemplugins()
plugins = {
exec="Exec",
email="E-Mail",
disk="Datenträger",
irq="Interrupts",
processes="Prozesse"
}
tpl.render("admin_statistics/systemplugins", {plugins=plugins})
end
function statistics_networkplugins()
plugins = {
interface="Schnittstellen",
netlink="Netlink",
iptables="Firewall",
tcpconns="Verbindungen",
ping="Ping",
dns="DNS"
}
tpl.render("admin_statistics/networkplugins", {plugins=plugins})
end

View file

@ -1 +0,0 @@
module("ffluci.controller.public.statistics", package.seeall)

View file

@ -1,31 +0,0 @@
add( "admin", "statistics", "Statistiken", 70 )
--act( "apache", "Apache" )
--act( "apcups", "Apcups" )
--act( "ascent", "Ascent" )
--act( "cpufreq", "Cpufreq" )
act( "csv", "CSV" )
act( "df", "Speicher" )
act( "disk", "Festplatte" )
act( "dns", "DNS" )
act( "email", "E-Mail" )
act( "exec", "Exec" )
act( "interface", "Schnittstellen" )
act( "iptables", "Firewall" )
act( "irq", "Interrupts" )
act( "logfile", "Protokolldateien" )
act( "netlink", "Netlink" )
act( "network", "Netzwerk" )
--act( "nginx", "nginx Server" )
--act( "ntpd", "NTP Server" )
act( "ping", "Ping" )
--act( "powerdns", "Powerdns Server" )
act( "processes", "Prozesse" )
act( "rrdtool", "RRDTool" )
--act( "sensors", "Sensoren" )
--act( "snmp", "SNMP Datenquellen" )
--act( "syslog", "Systemlog" )
--act( "tail", "Dateiverfolgung" )
--act( "teamspeak2", "TeamSpeak 2" )
act( "tcpconns", "TCP Verbindungen" )
act( "unixsock", "UNIX Socket" )
--act( "vmem", "Vmem" )

View file

@ -0,0 +1,8 @@
<%+header%>
<h1><%:stat Statistiken%></h1>
<p><%:stat_desc Die Statistiken bauen auf <a href="http://collectd.org/index.shtml">Collectd</a> auf und nutzen
<a href="http://oss.oetiker.ch/rrdtool/">RRD Tool</a> um Graphen aus den erfassten Daten zu rendern.%></p>
<%+footer%>

View file

@ -0,0 +1,18 @@
<%+header%>
<h1><%:stat_networkplugins Netzwerkplugins%></h1>
<p><%:stat_networkplugins_desc Netzwerkplugins sammeln Werte über offene TCP-Verbindung, allgemeines Verkehrsaufkommen
auf verschiedenen Schnittstellen, DNS-Verkehr u.v.m.%></p>
<p><%:stat_networkplugins_installed Installierte Netzwerkplugins:%>
<ul>
<% for plugin, desc in pairs(plugins) do %>
<% if ffluci.fs.isfile("/usr/lib/collectd/" .. plugin .. ".so") then %>
<li><a href="/cgi-bin/ffluci/admin/statistics/network/<%=plugin%>"><%=desc%></a></li>
<% end %>
<% end %>
</ul>
</p>
<%+footer%>

View file

@ -0,0 +1,19 @@
<%+header%>
<h1><%:stat_outputplugins Ausgabeplugins%></h1>
<p><%:stat_outputplugins_desc Ausgabeplugins stellen verschiedene Möglichkeiten zur Speicherung
der Daten bereit. Es können auch mehrere Plugins gleichzeitig aktiviert werden um beispielsweise
die gesammelten Werte in RRD-Datenbanken zu sichern und zusätzlich über das Netzwerk zu versenden.%></p>
<p><%:stat_outputplugins_installed Installierte Ausgabeplugins:%>
<ul>
<% for plugin, desc in pairs(plugins) do %>
<% if ffluci.fs.isfile("/usr/lib/collectd/" .. plugin .. ".so") then %>
<li><a href="/cgi-bin/ffluci/admin/statistics/output/<%=plugin%>"><%=desc%></a></li>
<% end %>
<% end %>
</ul>
</p>
<%+footer%>

View file

@ -0,0 +1,18 @@
<%+header%>
<h1><%:stat_systemplugins Systemplugins%></h1>
<p><%:stat_systemplugins_desc Systemplugins sammeln Werte über den aktuellen Systemzustand und den Ressourcenverbrauch
auf dem Gerät.%></p>
<p><%:stat_systemplugins_installed Installierte Systemplugins:%>
<ul>
<% for plugin, desc in pairs(plugins) do %>
<% if ffluci.fs.isfile("/usr/lib/collectd/" .. plugin .. ".so") then %>
<li><a href="/cgi-bin/ffluci/admin/statistics/system/<%=plugin%>"><%=desc%></a></li>
<% end %>
<% end %>
</ul>
</p>
<%+footer%>