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 function rrdargs( graph, plugin, plugin_instance, dtype )
19 if plugin_instance == "routes" then
22 -- diagram data description
23 title = "%H: Total amount of OLSR routes", vlabel = "n",
24 number_format = "%5.0lf", data = {
29 title = "Total number of routes"
36 title = "%H: Average route ETX", vlabel = "ETX", detail = true,
37 number_format = "%5.1lf",data = {
38 instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
39 types = { "route_etx" },
42 title = "Average route ETX"
49 title = "%H: Average route metric", vlabel = "metric", detail = true,
50 number_format = "%5.1lf", data = {
51 instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
52 types = { "route_metric" },
55 title = "Average route metric"
61 elseif plugin_instance == "links" then
64 -- diagram data description
65 title = "%H: Total amount of OLSR neighbours", vlabel = "n",
66 number_format = "%5.0lf", data = {
72 title = "Number of neighbours"
78 local instances = graph.tree:data_instances(plugin, plugin_instance, "signal_quality")
81 -- define one diagram per host, containing the rx and lq values
83 for i = 1, #instances, 2 do
84 local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_")
85 local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_")
86 local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+")
89 title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX",
90 number_format = "%5.2lf", detail = true,
92 types = { "signal_quality" },
95 signal_quality = { instances[i], instances[i+1] },
101 title = "LQ (%s)" % (host or "avg"),
105 title = "NLQ (%s)" % (host or "avg"),
113 elseif plugin_instance == "topology" then
116 title= "%H: Total amount of OLSR links", vlabel = "n",
117 number_format = "%5.0lf", data = {
123 title = "Total number of links"
130 title= "%H: Average signal quality", vlabel = "n",
131 number_format = "%5.2lf", detail = true,
133 instances = { "average" }, -- exclude possible per-ip stuff
134 types = { "signal_quality" },
138 title = "Average signal quality"