Skip to content

Instantly share code, notes, and snippets.

@odyssey4me
Created September 3, 2013 09:46
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 odyssey4me/6421795 to your computer and use it in GitHub Desktop.
Save odyssey4me/6421795 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# vim:ts=2:expandtab
require 'net/http'
require 'uri'
require 'json'
puts "Current CouchDB active tasks:"
uri = URI.parse("http://localhost:5984/_active_tasks")
res = Net::HTTP.get_response(uri)
puts JSON.pretty_generate(JSON.parse(res.body))
puts "Current chef database status:"
uri = URI.parse("http://localhost:5984/chef")
res = Net::HTTP.get_response(uri)
puts JSON.pretty_generate(JSON.parse(res.body))
%w(nodes roles registrations clients data_bags data_bag_items users checksums cookbooks sandboxes environments id_map).each do |view|
begin
uri = URI.parse("http://localhost:5984/chef/_design/#{view}/_info")
res = Net::HTTP.get_response(uri)
puts "Current status for chef view: #{view}"
puts JSON.pretty_generate(JSON.parse(res.body))
rescue
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment