Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Heroku jobs for Dashing. Returns the number of active dynos for each process type (including custom processes). Set your Heroku keys as environment variables.

Add the following to your Gemfile:

gem 'heroku-api'

Put heroku.rb in your jobs folder and add the contents of heroku.html into your layout.

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="heroku_dyno_web" data-view="Meter" data-title="Web Dynos" data-min="0" data-max="10"></div>
<li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
<div data-id="heroku_dyno_worker" data-view="Meter" data-title="Workers" data-min="0" data-max="10"></div>
require 'heroku-api'
app_name = ENV['HEROKU_APP_NAME']
heroku = => key)
SCHEDULER.every '15s', :first_in => 0 do |job|
ps = heroku.get_ps(app_name)
dynos = { |p| p['process'] }
process_counts = dynos.reduce({}) do |hash, dyno|
process, i = dyno.split(".")
hash[process] ||= 0
hash[process] += 1
process_counts.each do |ps, n|
send_event("heroku_dyno_#{ps}", { value: n })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.