Skip to content

Instantly share code, notes, and snippets.

Created June 23, 2014 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f68806cbd64d4dda40da to your computer and use it in GitHub Desktop.
Save anonymous/f68806cbd64d4dda40da to your computer and use it in GitHub Desktop.
def get_backup_metrics_per_node(node)
rest = ::Chef::REST.new(::Chef::Config[:chef_server_url])
begin
configured_backups = rest.get_rest("/nodes/#{node}").wf_backups.configured_backups
rescue EOFError => e
configured_backups = {}
end
res = {}
configured_backups.each_key do |type|
configured_backups[type].each_key do |subtype|
next unless configured_backups[type][subtype]['metrics']
res[type] = {} unless res[type]
res[type][subtype] = {} unless res[type][subtype]
res[type][subtype]['metrics'] = configured_backups[type][subtype]['metrics']
end
end
res
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment