Skip to content

Instantly share code, notes, and snippets.

@wjimenez5271
Created July 27, 2012 04:29
Show Gist options
  • Select an option

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

Select an option

Save wjimenez5271/3186181 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require File.expand_path('../../lib/riemann/tools', __FILE__)
class Riemann::Tools::KVM
include Riemann::Tools
def tick
#determine how many instances I have according to libvirt
kvm_instances = %x[virsh list |grep i-|wc -l]
#submit them to riemann
report(
:service => "KVM Running VMs",
:metric => kvm_instances.to_i,
:state => "info"
)
end
end
Riemann::Tools::KVM.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment