2 * Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
3 * Licensed to the public under the Apache License 2.0.
8 return L.Class.extend({
11 rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
14 if (plugin_instance == "routes") {
16 /* diagram data description */
17 title: "%H: Total amount of OLSR routes", vlabel: "n",
18 number_format: "%5.0lf", data: {
23 title: "Total number of routes"
28 title: "%H: Average route ETX", vlabel: "ETX", detail: true,
29 number_format: "%5.1lf", data: {
30 instances: [ "average" ], /* falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert */
31 types: [ "route_etx" ],
34 title: "Average route ETX"
39 title: "%H: Average route metric", vlabel: "metric", detail: true,
40 number_format: "%5.1lf", data: {
41 instances: [ "average" ], /* falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert */
42 types: [ "route_metric" ],
45 title: "Average route metric"
51 else if (plugin_instance == "links") {
53 /* diagram data description */
54 title: "%H: Total amount of OLSR neighbours", vlabel: "n",
55 number_format: "%5.0lf", data: {
61 title: "Number of neighbours"
67 var instances = graph.dataInstances(host, plugin, plugin_instance, "signal_quality").sort();
69 /* define one diagram per host, containing the rx and lq values */
70 for (var i = 0; i < instances.length; i += 2) {
71 var dsn1 = "signal_quality_%s_value".format(instances[i].replace(/\W+/g, '_')),
72 dsn2 = "signal_quality_%s_value".format(instances[i+1].replace(/\W+/g, '_')),
73 host = instances[i].match(/^[^-]+-([^-]+)-.+$/),
74 host = host ? host[1] : 'avg',
77 opts[dsn1] = { color: "00ff00", title: "LQ (%s)".format(host) };
78 opts[dns2] = { color: "0000ff", title: "NLQ (%s)".format(host), flip: true };
81 title: "%H: Signal Quality (%s)".format(host), vlabel: "ETX",
82 number_format: "%5.2lf", detail: true,
84 types: [ "signal_quality" ],
87 signal_quality: [ instances[i], instances[i+1] ],
95 else if (plugin_instance == "topology") {
97 title: "%H: Total amount of OLSR links", vlabel: "n",
98 number_format: "%5.0lf", data: {
104 title: "Total number of links"
109 title: "%H: Average signal quality", vlabel: "n",
110 number_format: "%5.2lf", detail: true,
112 instances: [ "average" ], /* exclude possible per-ip stuff */
113 types: [ "signal_quality" ],
117 title: "Average signal quality"