Merge pull request #776 from cshore/pull-request-statistics-nut
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / nut.lua
index 69f1ae3..dd93196 100644 (file)
@@ -1,17 +1,4 @@
---[[
-
-Luci statistics - ups plugin diagram definition
-Copyright © 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
-Copyright © 2012 David Woodhouse <dwmw2@infradead.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-]]--
-
+-- Licensed to the public under the Apache License 2.0.
 
 module("luci.statistics.rrdtool.definitions.nut",package.seeall)
 
@@ -45,26 +32,24 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
 
                        options = {
                                current_output  = { color = "00e000", title = "Output current", noarea=true, overlay=true },
-                               current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true },
+                               current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true }
                        }
                }
        }
 
        local percentage = {
-               title = "%H: Battery charge on UPS \"%pi\"",
+               title = "%H: Battery charge/load on UPS \"%pi\"",
                vlabel = "Percent",
                y_min = "0",
                y_max = "100",
                number_format = "%5.1lf%%",
                data = {
-                       sources = {
-                               percent = { "percent" }
-                       },
                        instances = {
-                               percent = "charge"
+                               percent = { "charge", "load" }
                        },
                        options = {
-                               percent_charge = { color = "00ff00", title = "Charge level"  }
+                               percent_charge = { color = "00ff00", title = "Charge level"  },
+                               percent_load = { color = "ff0000", title = "Load"  }
                        }
                }
        }
@@ -90,17 +75,43 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
                vlabel = "Minutes",
                number_format = "%.1lfm",
                data = {
-                       sources = {
-                               timeleft = { "timeleft" }
-                       },
                        instances = {
                                timeleft = { "battery" }
                        },
                        options = {
-                               timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/" }
+                               timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/", noarea=true }
+                       }
+               }
+       }
+
+       local power = {
+               title = "%H: Power on UPS \"%pi\"",
+               vlabel = "Power",
+               number_format = "%5.1lf%%",
+               data = {
+                       instances = {
+                               power = { "ups" }
+                       },
+                       options = {
+                               power_ups = { color = "00ff00", title = "Power level"  }
                        }
                }
        }
 
-       return { voltages, currents, percentage, temperature, timeleft }
+       local frequencies = {
+               title = "%H: Frequencies on UPS \"%pi\"",
+               vlabel = "Hz",
+               number_format = "%5.1lfHz",
+               data = {
+                       instances = {
+                               frequency = { "input", "output" }
+                       },
+
+                       options = {
+                               frequency_output  = { color = "00e000", title = "Output frequency", noarea=true, overlay=true },
+                               frequency_input   = { color = "ffb000", title = "Input frequency", noarea=true, overlay=true }
+                       }
+               }
+       }
+       return { voltages, currents, percentage, temperature, timeleft, power, frequencies }
 end