04eee9305124d937c3a4748a1b0d87b1f1dd6e4f
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / apcups.lua
1 -- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 module("luci.statistics.rrdtool.definitions.apcups",package.seeall)
5
6 function rrdargs( graph, plugin, plugin_instance, dtype )
7
8         local voltages = {
9                 title = "%H: Voltages on APC UPS ",
10                 vlabel = "V",
11                 number_format = "%5.1lfV",
12                 data = {
13                         instances = {
14                                 voltage = { "battery", "input", "output" }
15                         },
16
17                         options = {
18                                 voltage_output  = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
19                                 voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true },
20                                 voltage_input   = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
21                         }
22                 }
23         }
24
25         local percentload = {
26                 title = "%H: Load on APC UPS ",
27                 vlabel = "Percent",
28                 y_min = "0",
29                 y_max = "100",
30                 number_format = "%5.1lf%%",
31                 data = {
32                         sources = {
33                                 percent_load = { "value" }
34                         },
35                         instances = {
36                                 percent = "load"
37                         },
38                         options = {
39                                 percent_load = { color = "00ff00", title = "Load level"  }
40                         }
41                 }
42         }
43
44         local charge_percent = {
45                 title = "%H: Battery charge on APC UPS ",
46                 vlabel = "Percent",
47                 y_min = "0",
48                 y_max = "100",
49                 number_format = "%5.1lf%%",
50                 data = {
51                         types = { "charge" },
52                         options = {
53                                 charge = { color = "00ff0b", title = "Charge level"  }
54                         }
55                 }
56         }
57
58         local temperature = {
59                 title = "%H: Battery temperature on APC UPS ",
60                 vlabel = "\176C",
61                 number_format = "%5.1lf\176C",
62                 data = {
63                         types = { "temperature" },
64                         options = {
65                                 temperature = { color = "ffb000", title = "Battery temperature" } }
66                 }
67         }
68
69         local timeleft = {
70                 title = "%H: Time left on APC UPS ",
71                 vlabel = "Minutes",
72                 number_format = "%.1lfm",
73                 data = {
74                         sources = {
75                                 timeleft = { "value" }
76                         },
77                         options = {
78                                 timeleft = { color = "0000ff", title = "Time left" }
79                         }
80                 }
81         }
82
83         local frequency = {
84                 title = "%H: Incoming line frequency on APC UPS ",
85                 vlabel = "Hz",
86                 number_format = "%5.0lfhz",
87                 data = {
88                         sources = {
89                                 frequency_input = { "value" }
90                         },
91                         instances = {
92                                 frequency = "frequency"
93                         },
94                         options = {
95                                 frequency_frequency = { color = "000fff", title = "Line frequency" }
96                         }
97                 }
98         }
99
100         return { voltages, percentload, charge_percent, temperature, timeleft, frequency }
101 end