From de2e0ce10cb60d690da63c018f2162b47ef96141 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 8 Jun 2008 21:51:55 +0000 Subject: [PATCH] * luci/statistics: implement support for the load plugin --- .../luci_statistics/luci_statistics.lua | 2 +- .../luasrc/i18n/statistics.de.lua | 15 +++++++++ .../luasrc/i18n/statistics.en.lua | 15 +++++++++ .../luasrc/model/cbi/luci_statistics/load.lua | 25 ++++++++++++++ .../rrdtool/definitions/load/load.lua | 33 +++++++++++++++++++ .../root/usr/bin/stat-genconfig | 6 ++++ 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 applications/luci-statistics/luasrc/model/cbi/luci_statistics/load.lua create mode 100644 applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua 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 04cdd7ce2..be6430eed 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 4ba1e1ecd..9251c3210 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 1dd7c733b..14c1c6929 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 000000000..a58c3ec79 --- /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 + +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 000000000..c313d06e2 --- /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 + +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 609fd61b9..3159f6f7f 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" }, -- 2.25.1