Skip to content

Instantly share code, notes, and snippets.

@fixlr
Created January 8, 2013 17:31
Show Gist options
  • Save fixlr/4485872 to your computer and use it in GitHub Desktop.
Save fixlr/4485872 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
require 'yaml'
require 'librato/metrics'
hostname = `hostname`.strip
queue = Librato::Metrics::Queue.new
config = YAML::load_file(File.dirname(__FILE__) + '/metrics.yml')
Librato::Metrics.authenticate(config.fetch('username'), config.fetch('token'))
config.fetch('metrics', {}).each do |name, command|
metric = name.to_sym
count = `#{command}`.to_i
queue.add(metric => { source: hostname, value: count })
end
queue.submit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment