summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-04-29 20:26:48 +0300
committerGitHub <noreply@github.com>2017-04-29 20:26:48 +0300
commit1497d4ad480be2d047b6523ef8b68d051fac04a2 (patch)
tree919d8d3bbf8b37f268e1ff62ea4b89ae6284a9c0 /applications/luci-app-statistics
parenta83f0edec21ddd562636e61fd8dcf2fee5b97632 (diff)
parent5bf636732efab13fdd92dabfd746cafb156dd4f6 (diff)
Merge pull request #1132 from fantom-x/luci-collectd-mod-contextswitch
Support for collectd-mod-contextswitch
Diffstat (limited to 'applications/luci-app-statistics')
-rw-r--r--applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua3
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/contextswitch.lua14
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua23
-rw-r--r--applications/luci-app-statistics/root/etc/config/luci_statistics3
-rwxr-xr-xapplications/luci-app-statistics/root/usr/bin/stat-genconfig6
5 files changed, 48 insertions, 1 deletions
diff --git a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
index 36c5554d35..1bc0714de8 100644
--- a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
+++ b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
@@ -24,6 +24,7 @@ function index()
s_network = _("Network plugins"),
conntrack = _("Conntrack"),
+ contextswitch = _("Context Switches"),
cpu = _("Processor"),
cpufreq = _("CPU Frequency"),
csv = _("CSV Output"),
@@ -58,7 +59,7 @@ function index()
-- our collectd menu
local collectd_menu = {
output = { "csv", "network", "rrdtool", "unixsock" },
- general = { "cpu", "cpufreq", "df", "disk", "email",
+ general = { "contextswitch", "cpu", "cpufreq", "df", "disk", "email",
"entropy", "exec", "irq", "load", "memory",
"nut", "processes", "sensors", "thermal", "uptime" },
network = { "conntrack", "dns", "interface", "iptables",
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/contextswitch.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/contextswitch.lua
new file mode 100644
index 0000000000..7ae6b24ba1
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/contextswitch.lua
@@ -0,0 +1,14 @@
+-- Licensed to the public under the Apache License 2.0.
+
+m = Map("luci_statistics",
+ translate("CPU Context Switches Plugin Configuration"),
+ translate("This plugin collects statistics about the processor context switches."))
+
+-- collectd_contextswitch config section
+s = m:section( NamedSection, "collectd_contextswitch", "luci_statistics" )
+
+-- collectd_contextswitch.enable
+enable = s:option( Flag, "enable", translate("Enable this plugin") )
+enable.default = 0
+
+return m
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua
new file mode 100644
index 0000000000..6826e12adb
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua
@@ -0,0 +1,23 @@
+-- Licensed to the public under the Apache License 2.0.
+
+module("luci.statistics.rrdtool.definitions.contextswitch",package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+ return {
+ title = "%H: Context switches",
+ alt_autoscale = true,
+ vlabel = "Switches/s",
+ number_format = "%5.0lf",
+ data = {
+ types = { "contextswitch" },
+ sources = {
+ contextswitch = { "value" }
+ },
+ options = {
+ contextswitch = { color = "0000ff", title = "Context switches", noarea=true, overlay=true }
+ }
+ }
+ }
+end
+
diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics
index 774a8382e2..4a11ebc3e8 100644
--- a/applications/luci-app-statistics/root/etc/config/luci_statistics
+++ b/applications/luci-app-statistics/root/etc/config/luci_statistics
@@ -162,3 +162,6 @@ config statistics 'collectd_thermal'
config statistics 'collectd_uptime'
option enable '0'
+config statistics 'collectd_contextswitch'
+ option enable '0'
+
diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig
index c4542bbc2f..090344cee4 100755
--- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig
+++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig
@@ -279,6 +279,12 @@ plugins = {
{ }
},
+ contextswitch = {
+ { },
+ { },
+ { }
+ },
+
csv = {
{ "DataDir" },
{ "StoreRates" },