Skip to content

Instantly share code, notes, and snippets.

@wjimenez5271
Created July 25, 2012 00:01
Show Gist options
  • Select an option

  • Save wjimenez5271/3173526 to your computer and use it in GitHub Desktop.

Select an option

Save wjimenez5271/3173526 to your computer and use it in GitHub Desktop.
require 'riemann/client'
c = Riemann::Client.new host: 'euca-riemann', port: 5555
#find out my hostname
host = %x[hostname]
#first determine how many instances I have according to libvirt
kvm_instances = %x[virsh list |grep i-|wc -l]
#write it out to the console for now just to make sure I've got what I am expecting
puts kvm_instances.to_i
# then sends it ro riemann
c << {host: host, service: 'KVM', state: 'info', description: 'Number of KVM virtual machines currently running', metric: kvm_instances.to_i,}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment