mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 10:28:41 -05:00
(maint) Add the last boot time for each pool
This commit add a redis hash where there is one key per pool, and the stored value is the last time a VM was booted e.g. the last time a VM went from 'pending' to 'ready'. This is also displayed in the API as lastBoot:'2018-03-23 17:43:39 +0000'. The data can then be used by any external system, in this case our alarming system.
This commit is contained in:
parent
d57fc72fdb
commit
10245321bf
3 changed files with 22 additions and 11 deletions
|
|
@ -33,7 +33,7 @@ module Vmpooler
|
|||
begin
|
||||
_check_pending_vm(vm, pool, timeout, provider)
|
||||
rescue => err
|
||||
$logger.log('s', "[!] [#{pool}] '#{vm}' errored while checking a pending vm : #{err}")
|
||||
$logger.log('s', "[!] [#{pool}] '#{vm}' #{timeout} #{provider} errored while checking a pending vm : #{err}")
|
||||
fail_pending_vm(vm, pool, timeout)
|
||||
raise
|
||||
end
|
||||
|
|
@ -89,7 +89,10 @@ module Vmpooler
|
|||
finish = format('%.2f', Time.now - Time.parse(clone_time)) if clone_time
|
||||
|
||||
$redis.smove('vmpooler__pending__' + pool, 'vmpooler__ready__' + pool, vm)
|
||||
$redis.hset('vmpooler__boot__' + Date.today.to_s, pool + ':' + vm, finish)
|
||||
$redis.hset('vmpooler__boot__' + Date.today.to_s, pool + ':' + vm, finish) # maybe remove as this is never used by vmpooler itself?
|
||||
|
||||
# last boot time is displayed in API, and used by alarming script
|
||||
$redis.hset('vmpooler__lastboot', pool, Time.now)
|
||||
|
||||
$logger.log('s', "[>] [#{pool}] '#{vm}' moved from 'pending' to 'ready' queue")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue