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, is_index )
22 if plugin_instance == "routes" then
25 -- diagram data description
26 title = "%H: Total amount of OLSR routes", vlabel = "n",
27 number_format = "%5.0lf", data = {
32 title = "Total number of routes"
40 title = "%H: Average route ETX", vlabel = "ETX",
41 number_format = "%5.1lf",data = {
42 instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
43 types = { "route_etx" },
46 title = "Average route ETX"
53 title = "%H: Average route metric", vlabel = "metric",
54 number_format = "%5.1lf", data = {
55 instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
56 types = { "route_metric" },
59 title = "Average route metric"
66 elseif plugin_instance == "links" then
69 -- diagram data description
70 title = "%H: Total amount of OLSR neighbours", vlabel = "n",
71 number_format = "%5.0lf", data = {
77 title = "Number of neighbours"
84 local instances = tree:data_instances(plugin, plugin_instance, "signal_quality")
87 -- define one diagram per host, containing the rx and lq values
89 for i = 1, #instances, 2 do
90 local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_")
91 local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_")
92 local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+")
95 title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX",
96 number_format = "%5.2lf", data = {
97 types = { "signal_quality" },
100 signal_quality = { instances[i], instances[i+1] },
106 title = "LQ (%s)" % (host or "avg"),
110 title = "NLQ (%s)" % (host or "avg"),
119 elseif plugin_instance == "topology" then
122 title= "%H: Total amount of OLSR links", vlabel = "n",
123 number_format = "%5.0lf", data = {
127 links = { -- or: links__value is aber egal weils eh nur eines davon gibt
129 title = "Total number of links"
137 title= "%H: Average signal quality", vlabel = "n",
138 number_format = "%5.2lf", data = {
139 instances = { "average" }, -- exclude possible per-ip stuff
140 types = { "signal_quality" },
144 title = "Average signal quality"