Created
March 23, 2011 23:37
-
-
Save ampledata/884268 to your computer and use it in GitHub Desktop.
Cloudkick 'check' status update script in a few lines of ruby.
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
require 'rubygems' | |
require 'oauth' | |
require 'openssl' | |
# your OAuth consumer credentials. | |
# https://support.cloudkick.com/API/Authentication#Generating_OAuth_Consumers | |
CONSUMER_KEY = 'xxx' | |
CONSUMER_SECRET = 'yyy' | |
node_id='n359b40753' # your node_id | |
status='err' # or 'ok' | |
details="Donny, you're out of your element!" # or 'she probably kidnapped herself' | |
id='qc4a7b82cd' # your check_id | |
OAuth::AccessToken.new( OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, :site => 'https://api.cloudkick.com', :http_method => :get) ).post("/2.0/check/#{id}/update_status", { :status => status, :node_id => node_id, :details => details } ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment