3 Luci statistics - olsrd plugin diagram definition
5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
14 module("luci.statistics.rrdtool.definitions.olsrd", package.seeall)
16 local tree = luci.statistics.datatree.Instance()
18 function rrdargs( graph, plugin, plugin_instance, dtype )
21 if plugin_instance == "routes" then
24 -- diagram data description
25 title = "%H: Total amount of OLSR routes", vlabel = "n",
26 number_format = "%5.0lf", data = {
31 title = "Total number of routes"
38 title = "%H: Average route ETX", vlabel = "ETX", detail = true,
39 number_format = "%5.1lf",data = {
40 instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
41 types = { "route_etx" },
44 title = "Average route ETX"
51 title = "%H: Average route metric", vlabel = "metric", detail = true,
52 number_format = "%5.1lf", data = {
53 instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
54 types = { "route_metric" },
57 title = "Average route metric"
63 elseif plugin_instance == "links" then
66 -- diagram data description
67 title = "%H: Total amount of OLSR neighbours", vlabel = "n",
68 number_format = "%5.0lf", data = {
74 title = "Number of neighbours"
80 local instances = tree:data_instances(plugin, plugin_instance, "signal_quality")
83 -- define one diagram per host, containing the rx and lq values
85 for i = 1, #instances, 2 do
86 local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_")
87 local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_")
88 local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+")
91 title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX",
92 number_format = "%5.2lf", detail = true,
94 types = { "signal_quality" },
97 signal_quality = { instances[i], instances[i+1] },
103 title = "LQ (%s)" % (host or "avg"),
107 title = "NLQ (%s)" % (host or "avg"),
115 elseif plugin_instance == "topology" then
118 title= "%H: Total amount of OLSR links", vlabel = "n",
119 number_format = "%5.0lf", data = {
125 title = "Total number of links"
132 title= "%H: Average signal quality", vlabel = "n",
133 number_format = "%5.2lf", detail = true,
135 instances = { "average" }, -- exclude possible per-ip stuff
136 types = { "signal_quality" },
140 title = "Average signal quality"