8b04ab8b38795b5bc7942e502b38a7c1578584a0
[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 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"
49 },
50 options = {
51 percent_charge = { color = "00ff00", title = "Charge level" }
52 }
53 }
54 }
55
56 -- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century.
57 local temperature = {
58 title = "%H: Battery temperature on UPS \"%pi\"",
59 vlabel = "\176C",
60 number_format = "%5.1lf\176C",
61 data = {
62 instances = {
63 temperature = "battery"
64 },
65
66 options = {
67 temperature_battery = { color = "ffb000", title = "Battery temperature" }
68 }
69 }
70 }
71
72 local timeleft = {
73 title = "%H: Time left on UPS \"%pi\"",
74 vlabel = "Minutes",
75 number_format = "%.1lfm",
76 data = {
77 instances = {
78 timeleft = { "battery" }
79 },
80 options = {
81 timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/" }
82 }
83 }
84 }
85
86 return { voltages, currents, percentage, temperature, timeleft }
87 end