applications/luci-statistics: drop support for wireless plugin, add iwinfo replacement
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 7 Dec 2011 21:08:49 +0000 (21:08 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 7 Dec 2011 21:08:49 +0000 (21:08 +0000)
applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
applications/luci-statistics/luasrc/model/cbi/luci_statistics/iwinfo.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/model/cbi/luci_statistics/wireless.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua [deleted file]

index dea1618..a49c404 100644 (file)
@@ -58,15 +58,14 @@ function index()
                processes       = _("Processes"),
                rrdtool         = _("RRDTool"),
                tcpconns        = _("TCP Connections"),
-               unixsock        = _("UnixSock"),
-               wireless        = _("Wireless")
+               unixsock        = _("UnixSock")
        }
 
        -- our collectd menu
        local collectd_menu = {
                output  = { "csv", "network", "rrdtool", "unixsock" },
                system  = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "processes" },
-               network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "tcpconns", "wireless", "iwinfo" }
+               network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "tcpconns", "iwinfo" }
        }
 
        -- create toplevel menu nodes
diff --git a/applications/luci-statistics/luasrc/model/cbi/luci_statistics/iwinfo.lua b/applications/luci-statistics/luasrc/model/cbi/luci_statistics/iwinfo.lua
new file mode 100644 (file)
index 0000000..5e9340d
--- /dev/null
@@ -0,0 +1,38 @@
+--[[
+
+Luci configuration model for statistics - collectd interface plugin configuration
+(c) 2011 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+]]--
+
+local m, s, o
+
+m = Map("luci_statistics",
+       translate("Wireless iwinfo Plugin Configuration"),
+       translate("The iwinfo plugin collects statistics about wireless signal strength, noise and quality."))
+
+s = m:section(NamedSection, "collectd_iwinfo", "luci_statistics")
+
+o = s:option(Flag, "enable", translate("Enable this plugin"))
+o.default = 0
+
+o = s:option(Value, "Interfaces", translate("Monitor interfaces"),
+       translate("Leave unselected to automatically determine interfaces to monitor."))
+o.template = "cbi/network_ifacelist"
+o.widget   = "checkbox"
+o.nocreate = true
+o:depends("enable", 1)
+
+o = s:option(Flag, "IgnoreSelected", translate("Monitor all except specified"))
+o.default = 0
+o:depends("enable", 1)
+
+return m
diff --git a/applications/luci-statistics/luasrc/model/cbi/luci_statistics/wireless.lua b/applications/luci-statistics/luasrc/model/cbi/luci_statistics/wireless.lua
deleted file mode 100644 (file)
index f971c8c..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---[[
-
-Luci configuration model for statistics - collectd wireless plugin configuration
-(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
-]]--
-
-m = Map("luci_statistics",
-       translate("Wireless Plugin Configuration"),
-       translate(
-               "The wireless plugin collects statistics about wireless signal " ..
-               "strength, noise and quality."
-       ))
-
--- collectd_wireless config section
-s = m:section( NamedSection, "collectd_wireless", "luci_statistics" )
-
--- collectd_wireless.enable
-enable = s:option( Flag, "enable", translate("Enable this plugin") )
-enable.default = 0
-
-return m
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua
new file mode 100644 (file)
index 0000000..54c869f
--- /dev/null
@@ -0,0 +1,102 @@
+--[[
+
+Luci statistics - wireless plugin diagram definition
+(c) 2011 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.iwinfo", package.seeall)
+
+function rrdargs( graph, host, plugin, plugin_instance )
+
+       --
+       -- signal/noise diagram
+       --
+       local snr = {
+               title = "%H: Signal and noise on %pi",
+               vlabel = "dBm",
+               number_format = "%5.1lf dBm",
+               data = {
+                       types = { "signal_noise", "signal_power" },
+                       options = {
+                               signal_power = {
+                                       title  = "Signal",
+                                       overlay = true,
+                                       color   = "0000ff"
+                               },
+                               signal_noise = {
+                                       title   = "Noise",
+                                       overlay = true,
+                                       color   = "ff0000"
+                               }
+                       }
+               }
+       }
+
+
+       --
+       -- signal quality diagram
+       --
+       local quality = {
+               title = "%H: Signal quality on %pi",
+               vlabel = "Quality",
+               number_format = "%3.0lf",
+               data = {
+                       types = { "signal_quality" },
+                       options = {
+                               signal_quality = {
+                                       title  = "Quality",
+                                       noarea = true,
+                                       color  = "0000ff"
+                               }
+                       }
+               }
+       }
+
+
+       --
+       -- phy rate diagram
+       --
+       local bitrate = {
+               title = "%H: Average phy rate on %pi",
+               vlabel = "MBit/s",
+               number_format = "%5.1lf%sBit/s",
+               data = {
+                       types = { "bitrate" },
+                       options = {
+                               bitrate = {
+                                       title = "Rate",
+                                       color = "00ff00"
+                               }
+                       }
+               }
+       }
+
+       --
+       -- associated stations
+       --
+       local stations = {
+               title = "%H: Associated stations on %pi",
+               vlabel = "Stations",
+               number_format = "%3.0lf",
+               data = {
+                       types = { "stations" },
+                       options = {
+                               stations = {
+                                       title = "Stations",
+                                       color = "0000ff"
+                               }
+                       }
+               }
+       }
+
+       return { snr, quality, bitrate, stations }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua
deleted file mode 100644 (file)
index 7daddab..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
---[[
-
-Luci statistics - wireless plugin diagram definition
-(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
-]]--
-
-module("luci.statistics.rrdtool.definitions.wireless", package.seeall)
-
-function rrdargs( graph, host, plugin, plugin_instance )
-
-       --
-       -- signal/noise diagram
-       --
-       local snr = {
-
-               -- draw this diagram for each data instance
-               per_instance = true,
-
-               -- diagram data description
-               title = "%H: Signal to Noise Ratio on %pi",
-               vlabel = "dBm",
-               data = {
-                       types = { "signal_noise", "signal_power" },
-
-                       -- special options for single data lines
-                       options = {
-                               signal_power = {
-                                       overlay = true,         -- don't summarize
-                                       color   = "0000ff",     -- power is blue
-                                       title = "Signal",
-                               },
-
-                               signal_noise = {
-                                       overlay = true,         -- don't summarize
-                                       color   = "ff0000",     -- noise is red
-                                       title = "Noise",
-                               }
-                       }
-               }
-       }
-
-
-       --
-       -- signal quality diagram
-       --
-       local quality = {
-
-               -- draw this diagram for each data instance
-               per_instance = true,
-               title = "%H: Signal Quality on %pi",
-               vlabel = "n",
-
-               -- diagram data description
-               data = {
-                       types = { "signal_quality" },
-
-                       -- special options for single data lines
-                       options = {
-                               signal_quality = {
-                                       noarea = true,          -- don't draw area
-                                       color  = "0000ff",      -- quality is blue
-                                       title = "Signal Quality"
-                               }
-                       }
-               }
-       }
-
-       return { snr, quality }
-end