summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-06-08 21:51:55 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-06-08 21:51:55 +0000
commitde2e0ce10cb60d690da63c018f2162b47ef96141 (patch)
treeab303ac36c8c1d3003ef1d2a677b80b920b27266
parent0d4b628c7bb72b3785fd9ce7d71f85ddb6b250a0 (diff)
* luci/statistics: implement support for the load plugin
-rw-r--r--applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua2
-rw-r--r--applications/luci-statistics/luasrc/i18n/statistics.de.lua15
-rw-r--r--applications/luci-statistics/luasrc/i18n/statistics.en.lua15
-rw-r--r--applications/luci-statistics/luasrc/model/cbi/luci_statistics/load.lua25
-rw-r--r--applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua33
-rwxr-xr-xapplications/luci-statistics/root/usr/bin/stat-genconfig6
6 files changed, 95 insertions, 1 deletions
diff --git a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
index 04cdd7ce26..be6430eed2 100644
--- a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
+++ b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
@@ -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" }
}
diff --git a/applications/luci-statistics/luasrc/i18n/statistics.de.lua b/applications/luci-statistics/luasrc/i18n/statistics.de.lua
index 4ba1e1ecdc..9251c32108 100644
--- a/applications/luci-statistics/luasrc/i18n/statistics.de.lua
+++ b/applications/luci-statistics/luasrc/i18n/statistics.de.lua
@@ -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 = [[
diff --git a/applications/luci-statistics/luasrc/i18n/statistics.en.lua b/applications/luci-statistics/luasrc/i18n/statistics.en.lua
index 1dd7c733b8..14c1c69297 100644
--- a/applications/luci-statistics/luasrc/i18n/statistics.en.lua
+++ b/applications/luci-statistics/luasrc/i18n/statistics.en.lua
@@ -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
index 0000000000..a58c3ec79a
--- /dev/null
+++ b/applications/luci-statistics/luasrc/model/cbi/luci_statistics/load.lua
@@ -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
index 0000000000..c313d06e24
--- /dev/null
+++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua
@@ -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
diff --git a/applications/luci-statistics/root/usr/bin/stat-genconfig b/applications/luci-statistics/root/usr/bin/stat-genconfig
index 609fd61b9d..3159f6f7fa 100755
--- a/applications/luci-statistics/root/usr/bin/stat-genconfig
+++ b/applications/luci-statistics/root/usr/bin/stat-genconfig
@@ -298,6 +298,12 @@ plugins = {
{ "Irqs" }
},
+ load = {
+ { },
+ { },
+ { }
+ },
+
logfile = {
{ "LogLevel", "File" },
{ "Timestamp" },