luci-app-statistics: add advice about data directory permissions
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / nut.lua
1 -- Licensed to the public under the Apache License 2.0.
2
3 module("luci.statistics.rrdtool.definitions.nut",package.seeall)
4
5 function rrdargs( graph, plugin, plugin_instance, dtype )
6
7         local voltages = {
8                 title = "%H: Voltages on UPS \"%pi\"",
9                 vlabel = "V",
10                 number_format = "%5.1lfV",
11                 data = {
12                         instances = {
13                                 voltage = { "battery", "input", "output" }
14                         },
15
16                         options = {
17                                 voltage_output  = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
18                                 voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true },
19                                 voltage_input   = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
20                         }
21                 }
22         }
23
24         local currents = {
25                 title = "%H: Current on UPS \"%pi\"",
26                 vlabel = "A",
27                 number_format = "%5.3lfA",
28                 data = {
29                         instances = {
30                                 current = { "battery", "output" }
31                         },
32
33                         options = {
34                                 current_output  = { color = "00e000", title = "Output current", noarea=true, overlay=true },
35                                 current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true }
36                         }
37                 }
38         }
39
40         local percentage = {
41                 title = "%H: Battery charge/load on UPS \"%pi\"",
42                 vlabel = "Percent",
43                 y_min = "0",
44                 y_max = "100",
45                 number_format = "%5.1lf%%",
46                 data = {
47                         instances = {
48                                 percent = { "charge", "load" }
49                         },
50                         options = {
51                                 percent_charge = { color = "00ff00", title = "Charge level"  },
52                                 percent_load = { color = "ff0000", title = "Load"  }
53                         }
54                 }
55         }
56
57         -- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century.
58         local temperature = {
59                 title = "%H: Battery temperature on UPS \"%pi\"",
60                 vlabel = "\176C",
61                 number_format = "%5.1lf\176C",
62                 data = {
63                         instances = {
64                                 temperature = "battery"
65                         },
66
67                         options = {
68                                 temperature_battery = { color = "ffb000", title = "Battery temperature" }
69                         }
70                 }
71         }
72
73         local timeleft = {
74                 title = "%H: Time left on UPS \"%pi\"",
75                 vlabel = "Minutes",
76                 number_format = "%.1lfm",
77                 data = {
78                         instances = {
79                                 timeleft = { "battery" }
80                         },
81                         options = {
82                                 timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/", noarea=true }
83                         }
84                 }
85         }
86
87         local power = {
88                 title = "%H: Power on UPS \"%pi\"",
89                 vlabel = "Power",
90                 number_format = "%5.1lf%%",
91                 data = {
92                         instances = {
93                                 power = { "ups" }
94                         },
95                         options = {
96                                 power_ups = { color = "00ff00", title = "Power level"  }
97                         }
98                 }
99         }
100
101         local frequencies = {
102                 title = "%H: Frequencies on UPS \"%pi\"",
103                 vlabel = "Hz",
104                 number_format = "%5.1lfHz",
105                 data = {
106                         instances = {
107                                 frequency = { "input", "output" }
108                         },
109
110                         options = {
111                                 frequency_output  = { color = "00e000", title = "Output frequency", noarea=true, overlay=true },
112                                 frequency_input   = { color = "ffb000", title = "Input frequency", noarea=true, overlay=true }
113                         }
114                 }
115         }
116         return { voltages, currents, percentage, temperature, timeleft, power, frequencies }
117 end