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