applications/luci-statistics: add missing nut plugin entry to config menu
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool / definitions / nut.lua
1 --[[
2
3 Luci statistics - ups plugin diagram definition
4 Copyright © 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
5 Copyright © 2012 David Woodhouse <dwmw2@infradead.org>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 ]]--
14
15
16 module("luci.statistics.rrdtool.definitions.nut",package.seeall)
17
18 function rrdargs( graph, plugin, plugin_instance, dtype )
19
20         local voltages = {
21                 title = "%H: Voltages on UPS \"%pi\"",
22                 vlabel = "V",
23                 number_format = "%5.1lfV",
24                 data = {
25                         instances = {
26                                 voltage = { "battery", "input", "output" }
27                         },
28
29                         options = {
30                                 voltage_output  = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
31                                 voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true },
32                                 voltage_input   = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
33                         }
34                 }
35         }
36
37         local currents = {
38                 title = "%H: Current on UPS \"%pi\"",
39                 vlabel = "A",
40                 number_format = "%5.3lfA",
41                 data = {
42                         instances = {
43                                 current = { "battery", "output" }
44                         },
45
46                         options = {
47                                 current_output  = { color = "00e000", title = "Output current", noarea=true, overlay=true },
48                                 current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true },
49                         }
50                 }
51         }
52
53         local percentage = {
54                 title = "%H: Battery charge on UPS \"%pi\"",
55                 vlabel = "Percent",
56                 number_format = "%5.1lf%%",
57                 data = {
58                         sources = {
59                                 percent = { "percent" }
60                         },
61                         instances = {
62                                 percent = "charge"
63                         },
64                         options = {
65                                 percent_charge = { color = "00ff00", title = "Charge level"  }
66                         }
67                 }
68         }
69
70         -- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century.
71         local temperature = {
72                 title = "%H: Battery temperature on UPS \"%pi\"",
73                 vlabel = "\176C",
74                 number_format = "%5.1lf\176C",
75                 data = {
76                         instances = {
77                                 temperature = "battery"
78                         },
79
80                         options = {
81                                 temperature_battery = { color = "ffb000", title = "Battery temperature" }
82                         }
83                 }
84         }
85
86         local timeleft = {
87                 title = "%H: Time left on UPS \"%pi\"",
88                 vlabel = "seconds",
89                 number_format = "%7lfs",
90                 data = {
91                         sources = {
92                                 timeleft = { "timeleft" }
93                         },
94                         instances = {
95                                 timeleft = { "battery" }
96                         },
97                         options = {
98                                 timeleft_battery = { color = "0000ff", title = "Time left"}
99                         }
100                 }
101         }
102
103         return { voltages, currents, percentage, temperature, timeleft }
104 end