Skip to content

Instantly share code, notes, and snippets.

@drush
Last active September 11, 2017 17:05
Show Gist options
  • Save drush/8390853 to your computer and use it in GitHub Desktop.
Save drush/8390853 to your computer and use it in GitHub Desktop.
Show a report of the current number of web and worker dynos and the stack used across all your Heroku apps.
apps = `heroku apps`.split("\n\n")[0].lines[1..-1].collect{|l| l.strip }
printf("%-20s %4s %4s\n", 'APP', 'WEB', 'BG')
apps.each{|a|
astats = `heroku ps -a #{a}`
info = `heroku apps:info -a #{a}`
access = `heroku access -a #{a}`
stack = info.scan(/Stack:\s+(.*)/).first.last rescue 'NA'
web, workers = (astats.match(/web\.\d/).size rescue 0), (astats.match(/worker\.\d/).size rescue 0)
printf("%-20s %4s %4s %20s\t#{access}\n", a, web, workers, stack)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment