Skip to content

Instantly share code, notes, and snippets.

Created Jun 23, 2014
Embed
What would you like to do?
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