Created
February 19, 2014 01:54
-
-
Save chalfant/9084663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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