Skip to content

Instantly share code, notes, and snippets.

@chalfant
Created February 19, 2014 01:54
Show Gist options
  • Save chalfant/9084663 to your computer and use it in GitHub Desktop.
Save chalfant/9084663 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# obtain api key from: http://openweathermap.org/API
require 'librato/metrics'
require 'open_weather'
FISHERS_CITY_ID = 4257494
response = OpenWeather::Current.city_id(FISHERS_CITY_ID, 'APPID' => ENV['OPENWEATHER_APPID'])
outside_temp_k = response.parsed_response['main']['temp']
outside_temp_f = (outside_temp_k - 273.15) * 9 / 5 + 32
Librato::Metrics.authenticate ENV['LIBRATO_EMAIL'], ENV['LIBRATO_APITOKEN']
Librato::Metrics.submit :temperature => {:type => :gauge, :value => outside_temp_f, :source => 'outside_temp'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment