Merge pull request #980 from NvrBst/pull-request-upnp_description
[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 voltagesdc = {
9 title = "%H: Voltages on APC UPS - Battery",
10 vlabel = "Volts DC",
11 alt_autoscale = true,
12 number_format = "%5.1lfV",
13 data = {
14 instances = {
15 voltage = { "battery" }
16 },
17
18 options = {
19 voltage = { title = "Battery voltage", noarea=true }
20 }
21 }
22 }
23
24 local voltages = {
25 title = "%H: Voltages on APC UPS - AC",
26 vlabel = "Volts AC",
27 alt_autoscale = true,
28 number_format = "%5.1lfV",
29 data = {
30 instances = {
31 voltage = { "input", "output" }
32 },
33
34 options = {
35 voltage_output = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
36 voltage_input = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
37 }
38 }
39 }
40
41 local percentload = {
42 title = "%H: Load on APC UPS ",
43 vlabel = "Percent",
44 y_min = "0",
45 y_max = "100",
46 number_format = "%5.1lf%%",
47 data = {
48 sources = {
49 percent_load = { "value" }
50 },
51 instances = {
52 percent = "load"
53 },
54 options = {
55 percent_load = { color = "00ff00", title = "Load level" }
56 }
57 }
58 }
59
60 local charge_percent = {
61 title = "%H: Battery charge on APC UPS ",
62 vlabel = "Percent",
63 y_min = "0",
64 y_max = "100",
65 number_format = "%5.1lf%%",
66 data = {
67 types = { "charge" },
68 options = {
69 charge = { color = "00ff0b", title = "Charge level" }
70 }
71 }
72 }
73
74 local temperature = {
75 title = "%H: Battery temperature on APC UPS ",
76 vlabel = "\176C",
77 number_format = "%5.1lf\176C",
78 data = {
79 types = { "temperature" },
80 options = {
81 temperature = { color = "ffb000", title = "Battery temperature" } }
82 }
83 }
84
85 local timeleft = {
86 title = "%H: Time left on APC UPS ",
87 vlabel = "Minutes",
88 number_format = "%.1lfm",
89 data = {
90 sources = {
91 timeleft = { "value" }
92 },
93 options = {
94 timeleft = { color = "0000ff", title = "Time left" }
95 }
96 }
97 }
98
99 local frequency = {
100 title = "%H: Incoming line frequency on APC UPS ",
101 vlabel = "Hz",
102 number_format = "%5.0lfhz",
103 data = {
104 sources = {
105 frequency_input = { "value" }
106 },
107 instances = {
108 frequency = "frequency"
109 },
110 options = {
111 frequency_frequency = { color = "000fff", title = "Line frequency" }
112 }
113 }
114 }
115
116 return { voltages, voltagesdc, percentload, charge_percent, temperature, timeleft, frequency }
117 end