Skip to content

Instantly share code, notes, and snippets.

@alea12
Created June 23, 2017 06:56
Show Gist options
  • Save alea12/b88355937a1cd92577131b5d3939095e to your computer and use it in GitHub Desktop.
Save alea12/b88355937a1cd92577131b5d3939095e to your computer and use it in GitHub Desktop.
require 'json'
require 'open-uri'
require 'slack-notifier'
url = ENV["ETHERMINE_API_URL"]
json = JSON.load(open url)
message = "Unpaid Balance: #{json['unpaid'] / 10.0 ** 18} ETH \n"
json['workers'].each do |worker, status|
message << "#{worker}: #{status['hashrate']} \n"
end
notifier = Slack::Notifier.new(ENV["SLACK_WEBHOOK_URL"])
notifier.ping message.strip!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment