* luci/statistics: implement support for the load plugin
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 8 Jun 2008 21:51:55 +0000 (21:51 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 8 Jun 2008 21:51:55 +0000 (21:51 +0000)
applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
applications/luci-statistics/luasrc/i18n/statistics.de.lua
applications/luci-statistics/luasrc/i18n/statistics.en.lua
applications/luci-statistics/luasrc/model/cbi/luci_statistics/load.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua [new file with mode: 0644]
applications/luci-statistics/root/usr/bin/stat-genconfig

index 04cdd7ce2663af8c16860303501ec20d94d0dffd..be6430eed21994851d9f8cf413901c46ff926c5d 100644 (file)
@@ -44,7 +44,7 @@ function index()
        -- our collectd menu
        local collectd_menu = {
                output  = { "rrdtool", "network", "unixsock", "csv" },
-               system  = { "exec", "email", "cpu", "df", "disk", "irq", "processes" },
+               system  = { "exec", "email", "cpu", "df", "disk", "irq", "processes", "load" },
                network = { "interface", "netlink", "iptables", "tcpconns", "ping", "dns", "wireless" }
        }
 
index 4ba1e1ecdcf48c1261201f23918508be2898545e..9251c32108915b93794ae56ddb229e58c30254b0 100644 (file)
@@ -46,6 +46,7 @@ stat_exec      = "Exec"
 stat_rrdtool   = "RRDTool"
 stat_network   = "Netzwerk"
 stat_csv       = "CSV Ausgabe"
+stat_load      = "Systemlast"
 
 
 --
@@ -136,6 +137,12 @@ stat_dg_title_irq  = "%H: Interrupts"
 stat_dg_label_irq      = "Aufrufe/s"
 stat_ds_irq            = "IRQ %di"
 
+stat_dg_title_load      = "%H: Systemlast"
+stat_dg_label_load      = "Last"
+stat_ds_load__shortterm = "1 Minute"
+stat_ds_load__midterm   = "5 Minuten"
+stat_ds_load__longterm  = "15 Minuten"
+
 
 --
 -- CBI translations
@@ -306,6 +313,14 @@ lucistatistics_collectdirq_irqs           = "Interrups überwachen"
 lucistatistics_collectdirq_irqs_desc      = "mehrere mit Leerzeichen trennen"
 lucistatistics_collectdirq_ignoreselected = "Alle außer Ausgewählte überwachen"
 
+-- load plugin
+lucistatistics_collectdload        = "Load Plugin Konfiguration"
+lucistatistics_collectdload_desc   = [[
+        Das Load-Plugin sammelt Informationen über die allgemeine Systemlast. 
+]]
+
+lucistatistics_collectdload_enable = "Plugin aktivieren"
+
 -- netlink plugin
 lucistatistics_collectdnetlink            = "Netlink Plugin Konfiguration"
 lucistatistics_collectdnetlink_desc       = [[
index 1dd7c733b8a08fbf76095eab5854ba58c2587ce1..14c1c69297b884dcc23c094664d42e2aca69416f 100644 (file)
@@ -46,6 +46,7 @@ stat_exec      = "Exec"
 stat_rrdtool   = "RRDTool"
 stat_network   = "Network"
 stat_csv       = "CSV Output"
+stat_load      = "System Load"
 
 
 --
@@ -136,6 +137,12 @@ stat_dg_title_irq  = "%H: Interrupts"
 stat_dg_label_irq      = "Issues/s"
 stat_ds_irq            = "IRQ %di"
 
+stat_dg_title_load      = "%H: System Load"
+stat_dg_label_load      = "Load"
+stat_ds_load__shortterm = "1 min"
+stat_ds_load__midterm   = "5 min"
+stat_ds_load__longterm  = "15 min"
+
 
 --
 -- CBI translations
@@ -300,6 +307,14 @@ lucistatistics_collectdirq_irqs           = "Monitor interrupts"
 lucistatistics_collectdirq_irqs_desc      = "multiple separated by space"
 lucistatistics_collectdirq_ignoreselected = "Monitor all except selected ones"
 
+-- load plugin
+lucistatistics_collectdload        = "Load Plugin Configuration"
+lucistatistics_collectdload_desc   = [[
+       The load plugin collects statistics about the general system load.
+]]
+
+lucistatistics_collectdload_enable = "Enable this plugin"
+
 -- netlink plugin
 lucistatistics_collectdnetlink            = "Netlink Plugin Configuration"
 lucistatistics_collectdnetlink_desc       = [[
diff --git a/applications/luci-statistics/luasrc/model/cbi/luci_statistics/load.lua b/applications/luci-statistics/luasrc/model/cbi/luci_statistics/load.lua
new file mode 100644 (file)
index 0000000..a58c3ec
--- /dev/null
@@ -0,0 +1,25 @@
+--[[
+
+Luci configuration model for statistics - collectd load 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")
+
+-- collectd_wireless config section
+s = m:section( NamedSection, "collectd_load", "luci_statistics" )
+
+-- collectd_wireless.enable
+enable = s:option( Flag, "enable" )
+enable.default = 0
+
+return m
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua
new file mode 100644 (file)
index 0000000..c313d06
--- /dev/null
@@ -0,0 +1,33 @@
+--[[
+
+Luci statistics - load 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.load.load", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+       return {
+               data = {
+                       sources = {
+                               load = { "shortterm", "midterm", "longterm" }
+                       },
+
+                       options = {
+                               load__shortterm = { color = "ff0000" },
+                               load__midterm   = { color = "ff6600" },
+                               load__longterm  = { color = "ffaa00" }
+                       }
+               }
+       }
+end
index 609fd61b9d83cf764fd507339593e876d5ba645d..3159f6f7fa07774fd7e31d6e766bb60006fa9bae 100755 (executable)
@@ -298,6 +298,12 @@ plugins = {
                { "Irqs" }
        },
 
+       load    = {
+               { },
+               { },
+               { }
+       },
+
        logfile = {
                { "LogLevel", "File" },
                { "Timestamp" },