* luc/statistics: add file/license headers
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool / definitions / interface.lua
1 --[[
2
3 Luci statistics - interface plugin diagram definition
4 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 ]]--
15
16 module("luci.statistics.rrdtool.definitions.interface", package.seeall)
17
18 function rrdargs( graph, host, plugin, plugin_instance )
19
20 --
21 -- traffic diagram
22 --
23 local traffic = {
24
25 -- draw this diagram for each data instance
26 per_instance = true,
27
28 -- diagram data description
29 data = {
30 -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
31 sources = {
32 if_octets = { "tx", "rx" }
33 },
34
35 -- special options for single data lines
36 options = {
37 if_octets__tx = {
38 total = true, -- report total amount of bytes
39 color = "00ff00" -- tx is green
40 },
41
42 if_octets__rx = {
43 flip = true, -- flip rx line
44 total = true, -- report total amount of bytes
45 color = "0000ff" -- rx is blue
46 }
47 }
48 }
49 }
50
51
52 --
53 -- packet diagram
54 --
55 local packets = {
56
57 -- draw this diagram for each data instance
58 per_instance = true,
59
60 -- diagram data description
61 data = {
62 -- data type order
63 types = { "if_packets", "if_errors" },
64
65 -- defined sources for data types
66 sources = {
67 if_packets = { "tx", "rx" },
68 if_errors = { "tx", "rx" }
69 },
70
71 -- special options for single data lines
72 options = {
73 -- processed packets (tx DS)
74 if_packets__tx = {
75 overlay = true, -- don't summarize
76 total = true, -- report total amount of bytes
77 color = "00ff00" -- processed tx is green
78 },
79
80 -- processed packets (rx DS)
81 if_packets__rx = {
82 overlay = true, -- don't summarize
83 flip = true, -- flip rx line
84 total = true, -- report total amount of bytes
85 color = "0000ff" -- processed rx is blue
86 },
87
88 -- packet errors (tx DS)
89 if_errors__tx = {
90 overlay = true, -- don't summarize
91 total = true, -- report total amount of packets
92 color = "ff5500" -- tx errors are orange
93 },
94
95 -- packet errors (rx DS)
96 if_errors__rx = {
97 overlay = true, -- don't summarize
98 flip = true, -- flip rx line
99 total = true, -- report total amount of packets
100 color = "ff0000" -- rx errors are red
101 }
102 }
103 }
104 }
105
106 return { traffic, packets }
107 end