diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-14 13:27:43 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-14 13:27:43 +0000 |
commit | ac472f9ebc5ae0b92cec8b619a5b3f2c4a3fc5c1 (patch) | |
tree | dd2a0cc726cab3a0eb8c14a7c3cf8ea279c009e1 /applications/luci-statistics | |
parent | 1461a0dba1dc17cbae0963be3149fd1e8fe99698 (diff) |
luci-statistics: add transform_rpn option to graphs, use it for nut battery life
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'applications/luci-statistics')
-rw-r--r-- | applications/luci-statistics/luasrc/statistics/rrdtool.lua | 10 | ||||
-rw-r--r-- | applications/luci-statistics/luasrc/statistics/rrdtool/definitions/nut.lua | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-statistics/luasrc/statistics/rrdtool.lua index 45deb8509..e93ac0628 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool.lua @@ -156,11 +156,14 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index ) if not ds or ds:len() == 0 then ds = "value" end - _tif( _args, "DEF:%s_avg=%s:%s:AVERAGE", inst, rrd, ds ) + _tif( _args, "DEF:%s_avg_raw=%s:%s:AVERAGE", inst, rrd, ds ) + _tif( _args, "CDEF:%s_avg=%s_avg_raw,%s", inst, inst, source.transform_rpn ) if not self.opts.rrasingle then - _tif( _args, "DEF:%s_min=%s:%s:MIN", inst, rrd, ds ) - _tif( _args, "DEF:%s_max=%s:%s:MAX", inst, rrd, ds ) + _tif( _args, "DEF:%s_min_raw=%s:%s:MIN", inst, rrd, ds ) + _tif( _args, "CDEF:%s_min=%s_min_raw,%s", inst, inst, source.transform_rpn ) + _tif( _args, "DEF:%s_max_raw=%s:%s:MAX", inst, rrd, ds ) + _tif( _args, "CDEF:%s_max=%s_max_raw,%s", inst, inst, source.transform_rpn ) end _tif( _args, "CDEF:%s_nnl=%s_avg,UN,0,%s_avg,IF", inst, inst, inst ) @@ -403,6 +406,7 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index ) flip = dopts.flip or false, total = dopts.total or false, overlay = dopts.overlay or false, + transform_rpn = dopts.transform_rpn or "0,+", noarea = dopts.noarea or false, title = dopts.title or nil, ds = dsource, diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/nut.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/nut.lua index 421c7a25f..4072d4db1 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/nut.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/nut.lua @@ -86,7 +86,7 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) local timeleft = { title = "%H: Time left on UPS \"%pi\"", vlabel = "Minutes", - number_format = "%7lfm", + number_format = "%.1lfm", data = { sources = { timeleft = { "timeleft" } @@ -95,7 +95,7 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) timeleft = { "battery" } }, options = { - timeleft_battery = { color = "0000ff", title = "Time left"} + timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/" } } } } |