applications/luci-statistics: move all models to the per-plugin level, provide titles...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 28 Nov 2011 03:26:59 +0000 (03:26 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 28 Nov 2011 03:26:59 +0000 (03:26 +0000)
21 files changed:
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/df.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/df/df.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/disk.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/interface.lua
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_bytes.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/irq.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/irq/irq.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes.lua
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua [deleted file]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua

diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua
new file mode 100644 (file)
index 0000000..41bae39
--- /dev/null
@@ -0,0 +1,41 @@
+--[[
+
+Luci statistics - cpu 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: cpu.lua 2274 2008-06-03 23:15:16Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.cpu",package.seeall)
+
+function rrdargs( graph, host, plugin, plugin_instance, dtype )
+
+       return {
+               title = "%H: Processor usage on core #%pi",
+               vlabel = "Percent",
+               number_format = "%5.1lf%%",
+               data = {
+                       instances = { 
+                               cpu = { "idle", "user", "system", "nice" }
+                       },
+
+                       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" }
+                       }
+               }
+       }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua
deleted file mode 100644 (file)
index d6053a5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
---[[
-
-Luci statistics - cpu 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.cpu.cpu",package.seeall)
-
-function rrdargs( graph, host, plugin, plugin_instance, dtype )
-
-       return {
-               data = {
-                       instances = { 
-                               cpu = { "idle", "user", "system", "nice" }
-                       },
-
-                       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" }
-                       }
-               }
-       }
-end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/df.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/df.lua
new file mode 100644 (file)
index 0000000..fa206ba
--- /dev/null
@@ -0,0 +1,46 @@
+--[[
+
+Luci statistics - df 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: df.lua 2274 2008-06-03 23:15:16Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.df", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+       return {
+               title = "%H: Disk space usage on %di",
+               vlabel = "Bytes",
+               per_instance  = true,
+               number_format = "%5.1lf%sB",
+
+               data = {
+                       sources = {
+                               df = { "free", "used" }
+                       },
+
+                       options = {
+                               df__free = {
+                                       color = "00ff00",
+                                       overlay = false,
+                                       title = "free"
+                               },
+
+                               df__used = {
+                                       color = "ff0000",
+                                       overlay = false,
+                                       title = "used"
+                               }
+                       }
+               }
+       }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/df/df.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/df/df.lua
deleted file mode 100644 (file)
index 1d29800..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---[[
-
-Luci statistics - df 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.df.df", package.seeall)
-
-function rrdargs( graph, plugin, plugin_instance, dtype )
-
-       return {
-               per_instance  = true,
-               number_format = "%5.1lf%s",
-
-               data = {
-                       sources = {
-                               df = { "free", "used" }
-                       },
-
-                       options = {
-                               df__free = {
-                                       color = "00ff00"
-                               },
-
-                               df__used = {
-                                       color = "ff0000",
-                                       flip  = true
-                               }
-                       }
-               }
-       }
-end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/disk.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/disk.lua
new file mode 100644 (file)
index 0000000..b42faac
--- /dev/null
@@ -0,0 +1,72 @@
+--[[
+
+Luci statistics - df 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: df.lua 2274 2008-06-03 23:15:16Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.disk", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+       return {
+               {
+                       title = "%H: Disk I/O operations on %pi",
+                       vlabel = "Operations/s",
+                       number_format = "%5.1lf%sOp/s",
+
+                       data = {
+                               types = { "disk_ops" },
+                               sources = {
+                                       disk_ops = { "read", "write" },
+                               },
+
+                               options = {
+                                       disk_ops__read = {
+                                               title = "Reads",
+                                               color = "00ff00",
+                                               flip  = false
+                                       },
+
+                                       disk_ops__write = {
+                                               title = "Writes",
+                                               color = "ff0000",
+                                               flip  = true
+                                       }
+                               }
+                       }
+               },
+
+               {
+                       title = "%H: Disk I/O bandwidth on %pi",
+                       vlabel = "Bytes/s",
+                       number_format = "%5.1lf%sB/s",
+
+                       data = {
+                               types = { "disk_octets" },
+                               sources = {
+                                       disk_octets = { "read", "write" }
+                               },
+                               options = {
+                                       disk_octets__read = {
+                                               title = "Read",
+                                               color = "00ff00",
+                                               flip  = false
+                                       },
+                                       disk_octets__write = {
+                                               title = "Write",
+                                               color = "ff0000",
+                                               flip  = true
+                                       }
+                               }
+                       }
+               }
+       }
+end
index 029ffe3..35bc25b 100644 (file)
@@ -24,6 +24,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
 
                -- draw this diagram for each data instance
                per_instance = true,
+               title = "%H: Transfer on %di",
+               vlabel = "Bytes/s",
 
                -- diagram data description
                data = {
@@ -36,13 +38,15 @@ function rrdargs( graph, host, plugin, plugin_instance )
                        options = {
                                if_octets__tx = {
                                        total = true,           -- report total amount of bytes
-                                       color = "00ff00"        -- tx is green
+                                       color = "00ff00",       -- tx is green
+                                       title = "Bytes (TX)"
                                },
 
                                if_octets__rx = {
                                        flip  = true,           -- flip rx line
                                        total = true,           -- report total amount of bytes
-                                       color = "0000ff"        -- rx is blue
+                                       color = "0000ff",       -- rx is blue
+                                       title = "Bytes (RX)"
                                }
                        }
                }
@@ -56,6 +60,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
 
                -- draw this diagram for each data instance
                per_instance = true,
+               title = "%H: Packets on %di",
+               vlabel = "Packets/s",
 
                -- diagram data description
                data = {
@@ -74,7 +80,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
                                if_packets__tx = {
                                        overlay = true,         -- don't summarize
                                        total   = true,         -- report total amount of bytes
-                                       color   = "00ff00"      -- processed tx is green
+                                       color   = "00ff00",     -- processed tx is green
+                                       title   = "Processed (tx)"
                                },
 
                                -- processed packets (rx DS)
@@ -82,14 +89,16 @@ function rrdargs( graph, host, plugin, plugin_instance )
                                        overlay = true,         -- don't summarize
                                        flip    = true,         -- flip rx line
                                        total   = true,         -- report total amount of bytes
-                                       color   = "0000ff"      -- processed rx is blue
+                                       color   = "0000ff",     -- processed rx is blue
+                                       title   = "Processed (rx)"
                                },
 
                                -- packet errors (tx DS)
                                if_errors__tx = {
                                        overlay = true,         -- don't summarize
                                        total   = true,         -- report total amount of packets
-                                       color   = "ff5500"      -- tx errors are orange
+                                       color   = "ff5500",     -- tx errors are orange
+                                       title   = "Errors (tx)"
                                },
 
                                -- packet errors (rx DS)
@@ -97,7 +106,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
                                        overlay = true,         -- don't summarize
                                        flip    = true,         -- flip rx line
                                        total   = true,         -- report total amount of packets
-                                       color   = "ff0000"      -- rx errors are red
+                                       color   = "ff0000",     -- rx errors are red
+                                       title   = "Errors (rx)"
                                }
                        }
                }
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua
new file mode 100644 (file)
index 0000000..c1adbdc
--- /dev/null
@@ -0,0 +1,53 @@
+--[[
+
+Luci statistics - iptables 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: ipt_bytes.lua 2276 2008-06-03 23:18:37Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.iptables", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+       return {
+               {
+                       title = "%H: Firewall: Processed bytes in %pi",
+                       vlabel = "Bytes/s",
+                       number_format = "%5.0lf%sB/s",
+                       totals_format = "%5.0lf%sB",
+                       data = { 
+                               types = { "ipt_bytes" },
+                               options = {
+                                       ipt_bytes = {
+                                               total = true,
+                                               title = "%di"
+                                       }
+                               }
+                       }
+               },
+
+               {
+                       title = "%H: Firewall: Processed packets in %pi",
+                       vlabel = "Packets/s",
+                       number_format = "%5.1lf P/s",
+                       totals_format = "%5.0lf%s",
+                       data = {
+                               types = { "ipt_packets" },
+                               options = {
+                                       ipt_packets = {
+                                               total = true,
+                                               title = "%di"
+                                       }
+                               }
+                       }
+               }
+       }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_bytes.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_bytes.lua
deleted file mode 100644 (file)
index 15a0ea3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---[[
-
-Luci statistics - iptables 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.iptables.ipt_bytes", package.seeall)
-
-function rrdargs( graph, plugin, plugin_instance, dtype )
-
-       return {
-               data = { 
-                       options = {
-                               ipt_bytes = { total = true }
-                       }
-               }
-       }
-end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua
deleted file mode 100644 (file)
index e1dd507..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---[[
-
-Luci statistics - iptables 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.iptables.ipt_packets", package.seeall)
-
-function rrdargs( graph, plugin, plugin_instance, dtype )
-
-       return {
-               data = { 
-                       options = {
-                               ipt_packets = { total = true }
-                       }
-               }
-       }
-end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/irq.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/irq.lua
new file mode 100644 (file)
index 0000000..aabe14a
--- /dev/null
@@ -0,0 +1,30 @@
+--[[
+
+Luci statistics - irq 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: irq.lua 2276 2008-06-03 23:18:37Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.irq", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+       return {
+               title = "%H: Interrupts", vlabel = "Issues/s",
+               number_format = "%5.0lf", data = {
+                       types = { "irq" },
+                       options = {
+                               irq = { title = "IRQ %di", noarea = true }
+                       }
+               }
+       }
+
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/irq/irq.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/irq/irq.lua
deleted file mode 100644 (file)
index 67048c2..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---[[
-
-Luci statistics - irq 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.irq.irq", package.seeall)
-
-function rrdargs( graph, plugin, plugin_instance, dtype )
-
-       return {
-               data = {
-                       types = { "irq" }
-               }
-       }
-end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load.lua
new file mode 100644 (file)
index 0000000..8052696
--- /dev/null
@@ -0,0 +1,34 @@
+--[[
+
+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: load.lua 2329 2008-06-08 21:51:55Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.load", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+
+       return {
+               title = "%H: Load", vlabel = "Load",
+               number_format = "%5.2lf", data = {
+                       sources = {
+                               load = { "shortterm", "midterm", "longterm" }
+                       },
+
+                       options = {
+                               load__shortterm = { color = "ff0000", title = "1 minute", noarea = true },
+                               load__midterm   = { color = "ff6600", title = "5 minutes", noarea = true },
+                               load__longterm  = { color = "ffaa00", title = "15 minutes", noarea = true }
+                       }
+               }
+       }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/load/load.lua
deleted file mode 100644 (file)
index c313d06..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---[[
-
-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 daff584..0b4c6c2 100644 (file)
@@ -21,6 +21,8 @@ function rrdargs( graph, plugin, plugin_instance )
        -- traffic diagram
        --
        local traffic = {
+               title = "%H: Netlink - Transfer on %pi",
+               vlabel = "Bytes/s",
 
                -- diagram data description
                data = {
@@ -50,6 +52,8 @@ function rrdargs( graph, plugin, plugin_instance )
        -- packet diagram
        --
        local packets = {
+               title = "%H: Netlink - Packets on %pi",
+               vlabel = "Packets/s",
 
                -- diagram data description
                data = {
@@ -118,6 +122,8 @@ function rrdargs( graph, plugin, plugin_instance )
        -- multicast diagram
        --
        local multicast = {
+               title = "%H: Netlink - Multicast on %pi",
+               vlabel = "Packets/s",
 
                -- diagram data description
                data = {
@@ -140,6 +146,8 @@ function rrdargs( graph, plugin, plugin_instance )
        -- collision diagram
        --
        local collisions = {
+               title = "%H: Netlink - Collisions on %pi",
+               vlabel = "Collisions/s",
 
                -- diagram data description
                data = {
@@ -162,6 +170,8 @@ function rrdargs( graph, plugin, plugin_instance )
        -- error diagram
        --
        local errors = {
+               title = "%H: Netlink - Errors on %pi",
+               vlabel = "Errors/s",
 
                -- diagram data description
                data = {
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua
new file mode 100644 (file)
index 0000000..0ba3835
--- /dev/null
@@ -0,0 +1,153 @@
+--[[
+
+Luci statistics - olsrd plugin diagram definition
+
+Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
+
+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
+]]--
+
+module("luci.statistics.rrdtool.definitions.olsrd", package.seeall)
+
+local tree = luci.statistics.datatree.Instance()
+
+function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
+
+       local g = { }
+
+       if plugin_instance == "routes" then
+
+               g[#g+1] = {
+                       -- diagram data description
+                       title = "%H: Total amount of OLSR routes", vlabel = "n",
+                       number_format = "%5.0lf", data = {
+                               types = { "routes" },
+                               options = {
+                                       routes = {
+                                               color = "ff0000",
+                                               title = "Total number of routes"
+                                       }
+                               }
+                       }
+               }
+
+               if not is_index then
+                       g[#g+1] = {
+                               title = "%H: Average route ETX", vlabel = "ETX",
+                               number_format = "%5.1lf",data = {
+                                       instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
+                                       types = { "route_etx" },
+                                       options = {
+                                               route_etx = {
+                                                       title = "Average route ETX"
+                                               }
+                                       }
+                               }
+                       }
+
+                       g[#g+1] = {
+                               title = "%H: Average route metric", vlabel = "metric",
+                               number_format = "%5.1lf", data = {
+                                       instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
+                                       types = { "route_metric" },
+                                       options = {
+                                               route_metric = {
+                                                       title = "Average route metric"
+                                               }
+                                       }
+                               }
+                       }
+               end
+
+       elseif plugin_instance == "links" then
+
+               g[#g+1] = {
+                       -- diagram data description
+                       title = "%H: Total amount of OLSR neighbours", vlabel = "n",
+                       number_format = "%5.0lf", data = {
+                               instances = { "" },
+                               types = { "links" },
+                               options = {
+                                       links = {
+                                               color = "00ff00",
+                                               title = "Number of neighbours"
+                                       }
+                               }
+                       }
+               }
+
+               if not is_index then
+                       local instances = tree:data_instances(plugin, plugin_instance, "signal_quality")
+                       table.sort(instances)
+
+                       -- define one diagram per host, containing the rx and lq values
+                       local i
+                       for i = 1, #instances, 2 do
+                               local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_")
+                               local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_")
+                               local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+")
+
+                               g[#g+1] = {
+                               title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX",
+                               number_format = "%5.2lf", data = {
+                                               types = { "signal_quality" },
+       
+                                               instances = {
+                                                       signal_quality = { instances[i], instances[i+1] },
+                                               },
+
+                                               options = {
+                                                       [dsn1] = {
+                                                               color = "00ff00",
+                                                               title = "LQ (%s)" % (host or "avg"),
+                                                       },
+                                                       [dsn2] = {
+                                                               color = "0000ff",
+                                                               title = "NLQ (%s)" % (host or "avg"),
+                                                               flip  = true
+                                                       }
+                                               }
+                                       }
+                               }
+                       end
+               end
+
+       elseif plugin_instance == "topology" then
+
+               g[#g+1] = {
+                       title= "%H: Total amount of OLSR links", vlabel = "n",
+                       number_format = "%5.0lf", data = {
+                               instances = { "" },
+                               types = { "links" },
+                               options = {
+                                       links = { -- or: links__value is aber egal weils eh nur eines davon gibt
+                                               color = "0000ff",
+                                               title = "Total number of links"
+                                       }
+                               }
+                       }
+               }
+
+               if not is_index then
+                       g[#g+1] = {
+                               title= "%H: Average signal quality", vlabel = "n",
+                               number_format = "%5.2lf", data = {
+                                       instances = { "average" }, -- exclude possible per-ip stuff
+                                       types = { "signal_quality" },
+                                       options = {
+                                               signal_quality = {
+                                                       color = "0000ff",
+                                                       title = "Average signal quality"
+                                               }
+                                       }
+                               }
+                       }
+               end
+       end
+
+       return g
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping.lua
new file mode 100644 (file)
index 0000000..3b77cf1
--- /dev/null
@@ -0,0 +1,41 @@
+--[[
+
+Luci statistics - ping 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: ping.lua 6810 2011-01-29 03:33:48Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.ping", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
+       return {
+               -- Ping roundtrip time
+               { title = "%H: ICMP Round Trip Time", vlabel = "ms",
+                 number_format = "%5.1lf ms", data = {
+                       sources = { ping = { "ping" } },
+                       options = { ping__ping = { noarea = true, title = "%di" } }
+               } },
+
+               -- Ping droprate
+               { title = "%H: ICMP Drop Rate", vlabel = "%",
+                 number_format = "%5.2lf %%", data = {
+                       types   = { "ping_droprate" },
+                       options = { ping_droprate = { title = "%di" } }
+               } },
+
+               -- Ping standard deviation
+               { title = "%H: ICMP Standard Deviation", vlabel = "ms",
+                 number_format = "%5.2lf ms", data = {
+                       types   = { "ping_stddev" },
+                       options = { ping_stddev = { title = "%di" } }
+               } },
+       }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua
deleted file mode 100644 (file)
index 6a3bd5e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---[[
-
-Luci statistics - ping 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.ping.ping", package.seeall)
-
-function rrdargs( graph, plugin, plugin_instance, dtype )
-
-       return {
-               data = {
-                       sources = {
-                               ping = { "ping" }
-                       }
-               }
-       }
-end
index dacba13..fcbb982 100644 (file)
@@ -15,10 +15,12 @@ $Id$
 
 module("luci.statistics.rrdtool.definitions.processes", package.seeall)
 
-function rrdargs( graph, plugin, plugin_instance )
+function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
 
-       if plugin_instance == "" then
+       if is_index then 
                return {
+                       title = "%H: Processes",
+                       vlabel = "Processes/s",
                        data = {
                                instances = {
                                        ps_state = {
@@ -38,8 +40,9 @@ function rrdargs( graph, plugin, plugin_instance )
                }
        else
                return {
-
                        {
+                               title = "%H: CPU time used by %pi",
+                               vlabel = "Jiffies",
                                data = {
                                        sources = {
                                                ps_cputime = { "syst", "user" }
@@ -60,6 +63,8 @@ function rrdargs( graph, plugin, plugin_instance )
                        },
 
                        {
+                               title = "%H: Threads and processes belonging to %pi",
+                               vlabel = "Count",
                                data = {
                                        sources = {
                                                ps_count = { "threads", "processes" }
@@ -73,6 +78,8 @@ function rrdargs( graph, plugin, plugin_instance )
                        },
 
                        {
+                               title = "%H: Page faults in %pi",
+                               vlabel = "Pagefaults",
                                data = {
                                        sources = {
                                                ps_pagefaults = { "minflt", "majflt" }
@@ -86,8 +93,9 @@ function rrdargs( graph, plugin, plugin_instance )
                        },
 
                        {
-                               number_format = "%5.1lf%s",
-
+                               title = "%H: Virtual memory size of %pi",
+                               vlabel = "Bytes",
+                               number_format = "%5.1lf%sB",
                                data = {
                                        types = { "ps_rss" },
 
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua
new file mode 100644 (file)
index 0000000..4e00cbe
--- /dev/null
@@ -0,0 +1,38 @@
+--[[
+
+Luci statistics - tcpconns 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: tcp_connections.lua 2274 2008-06-03 23:15:16Z jow $
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.tcpconns", package.seeall)
+
+function rrdargs( graph, plugin, plugin_instance, dtype )
+       return {
+               title = "%H: TCP connections to port %pi",
+               vlabel = "Connections/s",
+               number_format = "%5.0lf",
+               data = {
+                       types = { "tcp_connections" },
+                       instances = {
+                               tcp_connections = {
+                                       "SYN_SENT", "SYN_RECV", "LISTEN", "ESTABLISHED",
+                                       "LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT",
+                                       "CLOSED", "FIN_WAIT1", "FIN_WAIT2"
+                               },
+                               options = { for k, v in (tcp_connections) do
+                                       v = { title = "%di", noarea = true }
+                                       end
+                               }
+                       }
+               }
+       }
+end
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua
deleted file mode 100644 (file)
index 9f62541..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---[[
-
-Luci statistics - tcpconns 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.tcpconns.tcp_connections", package.seeall)
-
-function rrdargs( graph, plugin, plugin_instance, dtype )
-
-       return {
-               data = {
-                       instances = {
-                               tcp_connections = {
-                                       "SYN_SENT", "SYN_RECV", "LISTEN", "ESTABLISHED",
-                                       "LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT",
-                                       "CLOSED", "FIN_WAIT1", "FIN_WAIT2"
-                               }
-                       }
-               }
-       }
-end
index 9bcbc06..7daddab 100644 (file)
@@ -26,6 +26,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
                per_instance = true,
 
                -- diagram data description
+               title = "%H: Signal to Noise Ratio on %pi",
+               vlabel = "dBm",
                data = {
                        types = { "signal_noise", "signal_power" },
 
@@ -33,12 +35,14 @@ function rrdargs( graph, host, plugin, plugin_instance )
                        options = {
                                signal_power = {
                                        overlay = true,         -- don't summarize
-                                       color   = "0000ff"      -- power is blue
+                                       color   = "0000ff",     -- power is blue
+                                       title = "Signal",
                                },
 
                                signal_noise = {
                                        overlay = true,         -- don't summarize
-                                       color   = "ff0000"      -- noise is red
+                                       color   = "ff0000",     -- noise is red
+                                       title = "Noise",
                                }
                        }
                }
@@ -52,6 +56,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
 
                -- draw this diagram for each data instance
                per_instance = true,
+               title = "%H: Signal Quality on %pi",
+               vlabel = "n",
 
                -- diagram data description
                data = {
@@ -61,7 +67,8 @@ function rrdargs( graph, host, plugin, plugin_instance )
                        options = {
                                signal_quality = {
                                        noarea = true,          -- don't draw area
-                                       color  = "0000ff"       -- quality is blue
+                                       color  = "0000ff",      -- quality is blue
+                                       title = "Signal Quality"
                                }
                        }
                }