- -- override i18n(): try to translate stat_<str> or fall back to <str>
- function _i18n( str )
- return luci.i18n.translate( "stat_" .. str, str )
- end
-
-
- entry({"admin", "statistics"}, call("statistics_index"), _i18n("statistics"), 80).i18n = "statistics"
- entry({"admin", "statistics", "collectd"}, cbi("luci_statistics/collectd"), _i18n("collectd"), 10)
-
- entry({"admin", "statistics", "output"}, call("statistics_outputplugins"), _i18n("outputplugins"), 20)
- _entry({"admin", "statistics", "output", "rrdtool"}, cbi("luci_statistics/rrdtool"), _i18n("rrdtool"), 10)
- _entry({"admin", "statistics", "output", "network"}, cbi("luci_statistics/network"), _i18n("network"), 20)
- _entry({"admin", "statistics", "output", "unixsock"}, cbi("luci_statistics/unixsock"), _i18n("unixsock"), 30)
- _entry({"admin", "statistics", "output", "csv"}, cbi("luci_statistics/csv"), _i18n("csv"), 40)
-
- entry({"admin", "statistics", "system"}, call("statistics_systemplugins"), _i18n("systemplugins"), 30)
- _entry({"admin", "statistics", "system", "exec"}, cbi("luci_statistics/exec"), _i18n("exec"), 10)
- _entry({"admin", "statistics", "system", "email"}, cbi("luci_statistics/email"), _i18n("email"), 20)
- _entry({"admin", "statistics", "system", "cpu"}, cbi("luci_statistics/cpu"), _i18n("cpu"), 30)
- _entry({"admin", "statistics", "system", "df"}, cbi("luci_statistics/df"), _i18n("df"), 40)
- _entry({"admin", "statistics", "system", "disk"}, cbi("luci_statistics/disk"), _i18n("disk"), 50)
- _entry({"admin", "statistics", "system", "irq"}, cbi("luci_statistics/irq"), _i18n("irq"), 60)
- _entry({"admin", "statistics", "system", "processes"}, cbi("luci_statistics/processes"), _i18n("processes"), 70)
-
- entry({"admin", "statistics", "network"}, call("statistics_networkplugins"), _i18n("networkplugins"),40)
- _entry({"admin", "statistics", "network", "interface"}, cbi("luci_statistics/interface"), _i18n("interface"), 10)
- _entry({"admin", "statistics", "network", "netlink"}, cbi("luci_statistics/netlink"), _i18n("netlink"), 20)
- _entry({"admin", "statistics", "network", "iptables"}, cbi("luci_statistics/iptables"), _i18n("iptables"), 30)
- _entry({"admin", "statistics", "network", "tcpconns"}, cbi("luci_statistics/tcpconns"), _i18n("tcpconns"), 40)
- _entry({"admin", "statistics", "network", "ping"}, cbi("luci_statistics/ping"), _i18n("ping"), 50)
- _entry({"admin", "statistics", "network", "dns"}, cbi("luci_statistics/dns"), _i18n("dns"), 60)
- _entry({"admin", "statistics", "network", "wireless"}, cbi("luci_statistics/wireless"), _i18n("wireless"), 70)
+ local labels = {
+ s_output = _("Output plugins"),
+ s_system = _("System plugins"),
+ s_network = _("Network plugins"),
+
+ conntrack = _("Conntrack"),
+ cpu = _("Processor"),
+ csv = _("CSV Output"),
+ df = _("Disk Space Usage"),
+ disk = _("Disk Usage"),
+ dns = _("DNS"),
+ email = _("Email"),
+ exec = _("Exec"),
+ interface = _("Interfaces"),
+ iptables = _("Firewall"),
+ irq = _("Interrupts"),
+ iwinfo = _("Wireless"),
+ load = _("System Load"),
+ memory = _("Memory"),
+ netlink = _("Netlink"),
+ network = _("Network"),
+ nut = _("UPS"),
+ olsrd = _("OLSRd"),
+ ping = _("Ping"),
+ processes = _("Processes"),
+ rrdtool = _("RRDTool"),
+ tcpconns = _("TCP Connections"),
+ unixsock = _("UnixSock")
+ }
+
+ -- our collectd menu
+ local collectd_menu = {
+ output = { "csv", "network", "rrdtool", "unixsock" },
+ system = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "nut", "processes" },
+ network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "tcpconns", "iwinfo" }
+ }
+
+ -- create toplevel menu nodes
+ local st = entry({"admin", "statistics"}, template("admin_statistics/index"), _("Statistics"), 80)
+ st.index = true
+
+ entry({"admin", "statistics", "collectd"}, cbi("luci_statistics/collectd"), _("Collectd"), 10).subindex = true
+
+
+ -- populate collectd plugin menu
+ local index = 1
+ for section, plugins in luci.util.kspairs( collectd_menu ) do
+ local e = entry(
+ { "admin", "statistics", "collectd", section },
+ firstchild(), labels["s_"..section], index * 10
+ )
+
+ e.index = true
+
+ for j, plugin in luci.util.vspairs( plugins ) do
+ _entry(
+ { "admin", "statistics", "collectd", section, plugin },
+ cbi("luci_statistics/" .. plugin ),
+ labels[plugin], j * 10
+ )
+ end