summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics
diff options
context:
space:
mode:
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/entropy.lua14
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool.lua6
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua19
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua19
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua2
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua2
-rw-r--r--applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm7
-rw-r--r--applications/luci-app-statistics/root/etc/config/luci_statistics296
-rwxr-xr-xapplications/luci-app-statistics/root/etc/init.d/luci_statistics10
-rwxr-xr-xapplications/luci-app-statistics/root/etc/uci-defaults/luci-statistics20
-rwxr-xr-xapplications/luci-app-statistics/root/usr/bin/stat-genconfig6
13 files changed, 223 insertions, 185 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 c532b4a6d3..49eab5acd4 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
@@ -30,6 +30,7 @@ function index()
disk = _("Disk Usage"),
dns = _("DNS"),
email = _("Email"),
+ entropy = _("Entropy"),
exec = _("Exec"),
interface = _("Interfaces"),
iptables = _("Firewall"),
@@ -53,7 +54,7 @@ function index()
-- our collectd menu
local collectd_menu = {
output = { "csv", "network", "rrdtool", "unixsock" },
- system = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "nut", "processes", "uptime" },
+ system = { "cpu", "df", "disk", "email", "entropy", "exec", "irq", "load", "memory", "nut", "processes", "uptime" },
network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "splash_leases", "tcpconns", "iwinfo" }
}
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua
new file mode 100644
index 0000000000..d18bf910f9
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua
@@ -0,0 +1,14 @@
+-- Copyright 2015 Hannu Nyman <hannu.nyman@iki.fi>
+-- Licensed to the public under the Apache License 2.0.
+
+m = Map("luci_statistics",
+ translate("Entropy Plugin Configuration"),
+ translate("The entropy plugin collects statistics about the available entropy."))
+
+s = m:section( NamedSection, "collectd_entropy", "luci_statistics" )
+
+enable = s:option( Flag, "enable", translate("Enable this plugin") )
+enable.default = 0
+
+return m
+
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
index 1f8f4ff88b..d8317a8177 100644
--- a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
@@ -457,6 +457,12 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
_ti ( _args, "-X" )
_ti ( _args, opts.units_exponent )
end
+ if opts.alt_autoscale then
+ _ti ( _args, "-A" )
+ end
+ if opts.alt_autoscale_max then
+ _ti ( _args, "-M" )
+ end
-- store additional rrd options
if opts.rrdopts then
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua
index ee3d68fe16..fbc47731ef 100644
--- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua
@@ -9,6 +9,10 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
vlabel = "Count",
number_format = "%5.0lf",
data = {
+ -- collectd 5.5+: specify "" to exclude "max" instance
+ instances = {
+ conntrack = { "" }
+ },
sources = {
conntrack = { "value" }
},
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua
index 1ca8a23ee9..ae0c0ce778 100644
--- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua
@@ -8,22 +8,23 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
return {
title = "%H: Processor usage on core #%pi",
y_min = "0",
+ alt_autoscale_max = true,
vlabel = "Percent",
number_format = "%5.1lf%%",
data = {
instances = {
- cpu = { "idle", "user", "system", "nice" }
+ cpu = { "user", "nice", "system", "softirq", "interrupt" }
},
options = {
- cpu_idle = { color = "ffffff" },
- cpu_nice = { color = "00e000" },
- cpu_user = { color = "0000ff" },
- cpu_wait = { color = "ffb000" },
- cpu_system = { color = "ff0000" },
- cpu_softirq = { color = "ff00ff" },
- cpu_interrupt = { color = "a000a0" },
- cpu_steal = { color = "000000" }
+ cpu_idle = { color = "ffffff", title = "Idle" },
+ cpu_nice = { color = "00e000", title = "Nice" },
+ cpu_user = { color = "0000ff", title = "User" },
+ cpu_wait = { color = "ffb000", title = "Wait" },
+ cpu_system = { color = "ff0000", title = "System" },
+ cpu_softirq = { color = "ff00ff", title = "Softirq" },
+ cpu_interrupt = { color = "a000a0", title = "Interrupt" },
+ cpu_steal = { color = "000000", title = "Steal" }
}
}
}
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua
new file mode 100644
index 0000000000..3d30a70afb
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua
@@ -0,0 +1,19 @@
+-- Copyright 2015 Hannu Nyman <hannu.nyman@iki.fi>
+-- Licensed to the public under the Apache License 2.0.
+
+module("luci.statistics.rrdtool.definitions.entropy", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+ return {
+ title = "%H: Available entropy",
+ vlabel = "bits",
+ number_format = "%4.0lf",
+ data = {
+ types = { "entropy" },
+ options = { entropy = { title = "Entropy %di" } }
+ }
+ }
+
+end
+
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua
index a1c65f56d7..53d559c599 100644
--- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua
@@ -17,6 +17,8 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
title = "%H: Memory usage",
vlabel = "MB",
number_format = "%5.1lf%s",
+ y_min = "0",
+ alt_autoscale_max = true,
data = {
instances = {
memory = { "free", "buffered", "cached", "used" }
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua
index 1a72caf227..347d756f7c 100644
--- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua
@@ -9,7 +9,7 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
{ title = "%H: ICMP Round Trip Time", vlabel = "ms",
number_format = "%5.1lf ms", data = {
sources = { ping = { "value" } },
- options = { ping__ping = { noarea = true, title = "%di" } }
+ options = { ping__value = { noarea = true, title = "%di" } }
} },
-- Ping droprate
diff --git a/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm b/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm
index 0000c1961e..0fb3d56375 100644
--- a/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm
+++ b/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm
@@ -8,7 +8,10 @@
<h2><a id="content" name="content"><%:Statistics%></a></h2>
-<p><%_The statistics package is based on <a href="http://collectd.org/index.shtml">Collectd</a>
-and uses <a href="http://oss.oetiker.ch/rrdtool/">RRD Tool</a> to render diagram images from collected data.%></p>
+<p><%_The statistics package uses <a href="https://collectd.org/">Collectd</a>
+to gather data and <a href="http://oss.oetiker.ch/rrdtool/">RRDtool</a> to
+render diagram images.%></p>
+
+<p><%_You can install additional collectd-mod-* plugins to enable more statistics.%></p>
<%+footer%>
diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics
index e39db3513a..abcee3e938 100644
--- a/applications/luci-app-statistics/root/etc/config/luci_statistics
+++ b/applications/luci-app-statistics/root/etc/config/luci_statistics
@@ -1,143 +1,153 @@
-config 'statistics' 'rrdtool'
- option 'default_timespan' '1hour'
- option 'image_width' '600'
- option 'image_path' '/tmp/rrdimg'
-
-config 'statistics' 'collectd'
- option 'BaseDir' '/var/run/collectd'
- option 'Include' '/etc/collectd/conf.d'
- option 'PIDFile' '/var/run/collectd.pid'
- option 'PluginDir' '/usr/lib/collectd'
- option 'TypesDB' '/usr/share/collectd/types.db'
- option 'Interval' '30'
- option 'ReadThreads' '2'
-
-config 'statistics' 'collectd_ping'
- option 'enable' '0'
- option 'TTL' '127'
- option 'Interval' '30'
- option 'Hosts' '127.0.0.1'
-
-config 'statistics' 'collectd_csv'
- option 'enable' '0'
- option 'StoreRates' '0'
- option 'DataDir' '/tmp'
-
-config 'statistics' 'collectd_df'
- option 'enable' '0'
- option 'Devices' '/dev/mtdblock/4'
- option 'MountPoints' '/jffs'
- option 'FSTypes' 'tmpfs'
- option 'IgnoreSelected' '0'
-
-config 'statistics' 'collectd_disk'
- option 'enable' '0'
- option 'Disks' 'hda1 hdb'
- option 'IgnoreSelected' '0'
-
-config 'statistics' 'collectd_dns'
- option 'enable' '0'
- option 'Interfaces' 'ffdhcp ff br-lan'
- option 'IgnoreSources' '127.0.0.1'
-
-config 'statistics' 'collectd_email'
- option 'enable' '0'
- option 'SocketFile' '/var/run/collectd/email.sock'
- option 'SocketGroup' 'nogroup'
-
-config 'statistics' 'collectd_exec'
- option 'enable' '0'
-
-config 'statistics' 'collectd_interface'
- option 'enable' '1'
- option 'Interfaces' 'br-lan br-ff'
- option 'IgnoreSelected' '0'
-
-config 'statistics' 'collectd_iptables'
- option 'enable' '1'
-
-config 'collectd_iptables_match'
- option 'table' 'nat'
- option 'chain' 'luci_fw_postrouting'
- option 'target' 'MASQUERADE'
- option 'source' '192.168.1.0/24'
- option 'outputif' 'br-ff'
- option 'name' 'Verkehr LAN-Clients'
-
-config 'collectd_iptables_match'
- option 'chain' 'luci_fw_postrouting'
- option 'table' 'nat'
- option 'target' 'MASQUERADE'
- option 'source' '10.61.230.0/24'
- option 'outputif' 'br-ff'
- option 'name' 'Verkehr WLAN-Clients'
-
-config 'statistics' 'collectd_irq'
- option 'enable' '0'
- option 'Irqs' '2 3 4 7'
-
-config 'statistics' 'collectd_load'
- option 'enable' '1'
-
-config 'statistics' 'collectd_logfile'
- option 'enable' '0'
- option 'LogLevel' 'notice'
- option 'File' '/var/log/collectd.log'
- option 'Timestamp' '1'
-
-config 'statistics' 'collectd_netlink'
- option 'enable' '0'
- option 'IgnoreSelected' '0'
- option 'VerboseInterfaces' 'br-lan br-ff'
- option 'QDiscs' 'br-lan br-ff'
-
-config 'statistics' 'collectd_network'
- option 'enable' '0'
-
-config 'statistics' 'collectd_processes'
- option 'enable' '1'
- option 'Processes' 'uhttpd dnsmasq dropbear'
-
-config statistics 'collectd_splash_leases'
- option enable '1'
-
-config 'statistics' 'collectd_tcpconns'
- option 'enable' '1'
- option 'ListeningPorts' '0'
- option 'LocalPorts' '22 80'
-
-config 'statistics' 'collectd_unixsock'
- option 'enable' '0'
- option 'SocketFile' '/var/run/collectd/query.sock'
- option 'SocketGroup' 'nogroup'
-
-config 'statistics' 'collectd_cpu'
- option 'enable' '1'
-
-config 'statistics' 'collectd_rrdtool'
- option 'enable' '1'
- option 'DataDir' '/tmp/rrd'
- option 'RRARows' '100'
- option 'RRASingle' '1'
- option 'RRATimespans' '1hour 1day 1week 1month 1year'
-
-config 'statistics' 'collectd_memory'
- option 'enable' '1'
-
-config 'statistics' 'collectd_conntrack'
- option 'enable' '1'
-
-config 'statistics' 'collectd_olsrd'
- option 'enable' '1'
- option 'Port' '2006'
- option 'Host' '127.0.0.1'
-
-config 'statistics' 'collectd_iwinfo'
- option 'enable' '1'
-
-config 'statistics' 'collectd_nut'
- option 'enable' '0'
- option 'UPS' 'myupsname'
-
-config 'statistics' 'collectd_uptime'
- option 'enable' '1'
+# general settings
+
+config statistics 'collectd'
+ option BaseDir '/var/run/collectd'
+ option Include '/etc/collectd/conf.d'
+ option PIDFile '/var/run/collectd.pid'
+ option PluginDir '/usr/lib/collectd'
+ option TypesDB '/usr/share/collectd/types.db'
+ option Interval '30'
+ option ReadThreads '2'
+
+config statistics 'rrdtool'
+ option default_timespan '1hour'
+ option image_width '600'
+ option image_path '/tmp/rrdimg'
+
+# output plugins
+
+config statistics 'collectd_rrdtool'
+ option enable '1'
+ option DataDir '/tmp/rrd'
+ option RRARows '100'
+ option RRASingle '1'
+ option RRATimespans '1hour 1day 1week 1month 1year'
+
+config statistics 'collectd_csv'
+ option enable '0'
+ option StoreRates '0'
+ option DataDir '/tmp'
+
+config statistics 'collectd_email'
+ option enable '0'
+ option SocketFile '/var/run/collectd/email.sock'
+ option SocketGroup 'nogroup'
+
+config statistics 'collectd_logfile'
+ option enable '0'
+ option LogLevel 'notice'
+ option File '/var/log/collectd.log'
+ option Timestamp '1'
+
+config statistics 'collectd_network'
+ option enable '0'
+
+config statistics 'collectd_unixsock'
+ option enable '0'
+ option SocketFile '/var/run/collectd/query.sock'
+ option SocketGroup 'nogroup'
+
+# input plugins
+
+config statistics 'collectd_conntrack'
+ option enable '0'
+
+config statistics 'collectd_cpu'
+ option enable '0'
+
+config statistics 'collectd_df'
+ option enable '0'
+ option Devices '/dev/mtdblock/4'
+ option MountPoints '/jffs'
+ option FSTypes 'tmpfs'
+ option IgnoreSelected '0'
+
+config statistics 'collectd_disk'
+ option enable '0'
+ option Disks 'hda1 hdb'
+ option IgnoreSelected '0'
+
+config statistics 'collectd_dns'
+ option enable '0'
+ option Interfaces 'br-lan'
+ option IgnoreSources '127.0.0.1'
+
+config statistics 'collectd_entropy'
+ option enable '0'
+
+config statistics 'collectd_exec'
+ option enable '0'
+
+config statistics 'collectd_interface'
+ option enable '1'
+ option Interfaces 'br-lan'
+ option IgnoreSelected '0'
+
+config statistics 'collectd_iptables'
+ option enable '0'
+
+config collectd_iptables_match
+ option table 'nat'
+ option chain 'luci_fw_postrouting'
+ option target 'MASQUERADE'
+ option source '192.168.1.0/24'
+ option outputif 'br-ff'
+ option name 'LAN-Clients traffic'
+
+config collectd_iptables_match
+ option chain 'luci_fw_postrouting'
+ option table 'nat'
+ option target 'MASQUERADE'
+ option source '10.61.230.0/24'
+ option outputif 'br-ff'
+ option name 'WLAN-Clients traffic'
+
+config statistics 'collectd_irq'
+ option enable '0'
+ option Irqs '2 3 4 7'
+
+config statistics 'collectd_iwinfo'
+ option enable '1'
+
+config statistics 'collectd_load'
+ option enable '1'
+
+config statistics 'collectd_memory'
+ option enable '0'
+
+config statistics 'collectd_netlink'
+ option enable '0'
+ option IgnoreSelected '0'
+ option VerboseInterfaces 'br-lan'
+ option QDiscs 'br-lan'
+
+config statistics 'collectd_nut'
+ option enable '0'
+ option UPS 'myupsname'
+
+config statistics 'collectd_olsrd'
+ option enable '0'
+ option Port '2006'
+ option Host '127.0.0.1'
+
+config statistics 'collectd_ping'
+ option enable '0'
+ option TTL '127'
+ option Interval '30'
+ option Hosts '127.0.0.1'
+
+config statistics 'collectd_processes'
+ option enable '0'
+ option Processes 'uhttpd dnsmasq dropbear'
+
+config statistics 'collectd_splash_leases'
+ option enable '0'
+
+config statistics 'collectd_tcpconns'
+ option enable '0'
+ option ListeningPorts '0'
+ option LocalPorts '22 80'
+
+config statistics 'collectd_uptime'
+ option enable '0'
+
diff --git a/applications/luci-app-statistics/root/etc/init.d/luci_statistics b/applications/luci-app-statistics/root/etc/init.d/luci_statistics
index 936f3a63c3..ab75b69df0 100755
--- a/applications/luci-app-statistics/root/etc/init.d/luci_statistics
+++ b/applications/luci-app-statistics/root/etc/init.d/luci_statistics
@@ -3,23 +3,15 @@ START=79
start() {
### replace shipped config with symlink
+ mkdir -p /var/etc
if [ ! -L /etc/collectd.conf ]; then
test -f /etc/collectd.conf && mv /etc/collectd.conf /etc/collectd.conf.bak
ln -s /var/etc/collectd.conf /etc/collectd.conf
fi
### create config
- mkdir -p /var/etc
/usr/bin/stat-genconfig > /var/etc/collectd.conf
- ### prepare rrdimg directory
- if [ -f /etc/config/lucid ] && [ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && \
- [ "$(uci get luci_statistics.rrdtool.image_path 2>/dev/null)" != "$(uci get lucid.statistics.physical 2>/dev/null)" ]; then
- uci set lucid.statistics.physical=$(uci get luci_statistics.rrdtool.image_path)
- uci commit lucid
- /etc/init.d/lucid restart
- fi
-
### workaround broken permissions on /tmp
chmod 1777 /tmp
}
diff --git a/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics b/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics
index e94a8637c8..28e35298a2 100755
--- a/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics
+++ b/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics
@@ -8,29 +8,9 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF
-# register LuCId virtual path handler
-[ -f /etc/config/lucid ] && \
-uci -q batch <<-EOF >/dev/null
- delete lucid.statistics
-
- set lucid.statistics=DirectoryPublisher
- set lucid.statistics.name='RRDTool Image Cache'
- set lucid.statistics.physical=/tmp/rrdimg
- set lucid.statistics.virtual=/rrdimg
- set lucid.statistics.domain=''
-
- add_list lucid.http.publisher=statistics
- add_list lucid.https.publisher=statistics
-
- commit lucid
-EOF
-
# symlink for busybox httpd
[ -x /usr/sbin/httpd ] && [ ! -h /www/rrdimg ] && \
ln -s /tmp/rrdimg /www/rrdimg
-# restart LuCId service
-[ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && /etc/init.d/lucid restart
-
rm -f /tmp/luci-indexcache
exit 0
diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig
index cb94e28118..8acae46c61 100755
--- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig
+++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig
@@ -303,6 +303,12 @@ plugins = {
{ }
},
+ entropy = {
+ { },
+ { },
+ { }
+ },
+
exec = config_exec,
interface = {