luci-app-statistics: add advice about data directory permissions
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / interface.lua
1 -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 module("luci.statistics.rrdtool.definitions.interface", package.seeall)
5
6 function rrdargs( graph, plugin, plugin_instance )
7
8         --
9         -- traffic diagram
10         --
11         local traffic = {
12
13                 -- draw this diagram for each plugin instance
14                 per_instance = true,
15                 title = "%H: Transfer on %pi",
16                 vlabel = "Bytes/s",
17
18                 -- diagram data description
19                 data = {
20                         -- defined sources for data types, if ommitted assume a single DS named "value" (optional)
21                         sources = {
22                                 if_octets = { "tx", "rx" }
23                         },
24
25                         -- special options for single data lines
26                         options = {
27                                 if_octets__tx = {
28                                         total = true,           -- report total amount of bytes
29                                         color = "00ff00",       -- tx is green
30                                         title = "Bytes (TX)"
31                                 },
32
33                                 if_octets__rx = {
34                                         flip  = true,           -- flip rx line
35                                         total = true,           -- report total amount of bytes
36                                         color = "0000ff",       -- rx is blue
37                                         title = "Bytes (RX)"
38                                 }
39                         }
40                 }
41         }
42
43
44         --
45         -- packet diagram
46         --
47         local packets = {
48
49                 -- draw this diagram for each plugin instance
50                 per_instance = true,
51                 title = "%H: Packets on %pi",
52                 vlabel = "Packets/s",
53
54                 -- diagram data description
55                 data = {
56                         -- data type order
57                         types = { "if_packets", "if_errors" },
58
59                         -- defined sources for data types
60                         sources = {
61                                 if_packets = { "tx", "rx" },
62                                 if_errors  = { "tx", "rx" }
63                         },
64
65                         -- special options for single data lines
66                         options = {
67                                 -- processed packets (tx DS)
68                                 if_packets__tx = {
69                                         weight  = 1,
70                                         overlay = true,         -- don't summarize
71                                         total   = true,         -- report total amount of bytes
72                                         color   = "00ff00",     -- processed tx is green
73                                         title   = "Processed (TX)"
74                                 },
75
76                                 -- processed packets (rx DS)
77                                 if_packets__rx = {
78                                         weight  = 2,
79                                         overlay = true,         -- don't summarize
80                                         flip    = true,         -- flip rx line
81                                         total   = true,         -- report total amount of bytes
82                                         color   = "0000ff",     -- processed rx is blue
83                                         title   = "Processed (RX)"
84                                 },
85
86                                 -- packet errors (tx DS)
87                                 if_errors__tx = {
88                                         weight  = 0,
89                                         overlay = true,         -- don't summarize
90                                         total   = true,         -- report total amount of packets
91                                         color   = "ff5500",     -- tx errors are orange
92                                         title   = "Errors    (TX)"
93                                 },
94
95                                 -- packet errors (rx DS)
96                                 if_errors__rx = {
97                                         weight  = 3,
98                                         overlay = true,         -- don't summarize
99                                         flip    = true,         -- flip rx line
100                                         total   = true,         -- report total amount of packets
101                                         color   = "ff0000",     -- rx errors are red
102                                         title   = "Errors    (RX)"
103                                 }
104                         }
105                 }
106         }
107
108         return { traffic, packets }
109 end