Rework LuCI build system
[project/luci.git] / applications / luci-app-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, plugin, plugin_instance )
19
20         --
21         -- traffic diagram
22         --
23         local traffic = {
24
25                 -- draw this diagram for each plugin instance
26                 per_instance = true,
27                 title = "%H: Transfer on %pi",
28                 vlabel = "Bytes/s",
29
30                 -- diagram data description
31                 data = {
32                         -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
33                         sources = {
34                                 if_octets = { "tx", "rx" }
35                         },
36
37                         -- special options for single data lines
38                         options = {
39                                 if_octets__tx = {
40                                         total = true,           -- report total amount of bytes
41                                         color = "00ff00",       -- tx is green
42                                         title = "Bytes (TX)"
43                                 },
44
45                                 if_octets__rx = {
46                                         flip  = true,           -- flip rx line
47                                         total = true,           -- report total amount of bytes
48                                         color = "0000ff",       -- rx is blue
49                                         title = "Bytes (RX)"
50                                 }
51                         }
52                 }
53         }
54
55
56         --
57         -- packet diagram
58         --
59         local packets = {
60
61                 -- draw this diagram for each plugin instance
62                 per_instance = true,
63                 title = "%H: Packets on %pi",
64                 vlabel = "Packets/s",
65
66                 -- diagram data description
67                 data = {
68                         -- data type order
69                         types = { "if_packets", "if_errors" },
70
71                         -- defined sources for data types
72                         sources = {
73                                 if_packets = { "tx", "rx" },
74                                 if_errors  = { "tx", "rx" }
75                         },
76
77                         -- special options for single data lines
78                         options = {
79                                 -- processed packets (tx DS)
80                                 if_packets__tx = {
81                                         overlay = true,         -- don't summarize
82                                         total   = true,         -- report total amount of bytes
83                                         color   = "00ff00",     -- processed tx is green
84                                         title   = "Processed (tx)"
85                                 },
86
87                                 -- processed packets (rx DS)
88                                 if_packets__rx = {
89                                         overlay = true,         -- don't summarize
90                                         flip    = true,         -- flip rx line
91                                         total   = true,         -- report total amount of bytes
92                                         color   = "0000ff",     -- processed rx is blue
93                                         title   = "Processed (rx)"
94                                 },
95
96                                 -- packet errors (tx DS)
97                                 if_errors__tx = {
98                                         overlay = true,         -- don't summarize
99                                         total   = true,         -- report total amount of packets
100                                         color   = "ff5500",     -- tx errors are orange
101                                         title   = "Errors (tx)"
102                                 },
103
104                                 -- packet errors (rx DS)
105                                 if_errors__rx = {
106                                         overlay = true,         -- don't summarize
107                                         flip    = true,         -- flip rx line
108                                         total   = true,         -- report total amount of packets
109                                         color   = "ff0000",     -- rx errors are red
110                                         title   = "Errors (rx)"
111                                 }
112                         }
113                 }
114         }
115
116         return { traffic, packets }
117 end