diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua')
-rw-r--r-- | applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua new file mode 100644 index 0000000000..3ca2f03ec8 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua @@ -0,0 +1,146 @@ +--[[ + +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) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + 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" + } + } + } + } + + g[#g+1] = { + title = "%H: Average route ETX", vlabel = "ETX", detail = true, + 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", detail = true, + 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" + } + } + } + } + + 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" + } + } + } + } + + local instances = graph.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", detail = true, + 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 + + 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 = { + color = "0000ff", + title = "Total number of links" + } + } + } + } + + g[#g+1] = { + title= "%H: Average signal quality", vlabel = "n", + number_format = "%5.2lf", detail = true, + data = { + instances = { "average" }, -- exclude possible per-ip stuff + types = { "signal_quality" }, + options = { + signal_quality = { + color = "0000ff", + title = "Average signal quality" + } + } + } + } + end + + return g +end |