mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #51 from sschneid/round_dashboard_capacity_percent
Round capacity percentage to 1 decimal place
This commit is contained in:
commit
44c917b50e
2 changed files with 4 additions and 4 deletions
|
|
@ -186,7 +186,7 @@ module Vmpooler
|
||||||
result[:status] = 0
|
result[:status] = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
result[:capacity_percent] = (result[:capacity_current].to_f / result[:capacity_total].to_f) * 100.0
|
result[:capacity_percent] = ((result[:capacity_current].to_f / result[:capacity_total].to_f) * 100.0).round(1)
|
||||||
|
|
||||||
result[:cloning] = $redis.get('vmpooler__tasks__clone')
|
result[:cloning] = $redis.get('vmpooler__tasks__clone')
|
||||||
result[:booting] = result[:pending].to_i - result[:cloning].to_i
|
result[:booting] = result[:pending].to_i - result[:cloning].to_i
|
||||||
|
|
@ -195,10 +195,10 @@ module Vmpooler
|
||||||
|
|
||||||
result[:clone_total] = $redis.hlen('vmpooler__clone__' + Date.today.to_s)
|
result[:clone_total] = $redis.hlen('vmpooler__clone__' + Date.today.to_s)
|
||||||
if result[:clone_total] > 0
|
if result[:clone_total] > 0
|
||||||
result[:clone_average] = $redis.hvals('vmpooler__clone__' + Date.today.to_s).map(&:to_f).reduce(:+) / result[:clone_total]
|
result[:clone_average] = ($redis.hvals('vmpooler__clone__' + Date.today.to_s).map(&:to_f).reduce(:+) / result[:clone_total]).round(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
result[:uptime] = Time.now - $config[:uptime] if $config[:uptime]
|
result[:uptime] = (Time.now - $config[:uptime]).round(1) if $config[:uptime]
|
||||||
|
|
||||||
JSON.pretty_generate(Hash[result.sort_by { |k, _v| k }])
|
JSON.pretty_generate(Hash[result.sort_by { |k, _v| k }])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ d3.json( numbers_url,
|
||||||
stats_vmpooler_numbers__svg[ 'clone_average' ]
|
stats_vmpooler_numbers__svg[ 'clone_average' ]
|
||||||
.append( 'text' )
|
.append( 'text' )
|
||||||
.text(
|
.text(
|
||||||
( stats_vmpooler_numbers__data__live[ 'clone_average' ].toFixed(1) + 's' )
|
( stats_vmpooler_numbers__data__live[ 'clone_average' ] + 's' )
|
||||||
)
|
)
|
||||||
.attr( {
|
.attr( {
|
||||||
'text-anchor': 'end',
|
'text-anchor': 'end',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue