Skip to content

Instantly share code, notes, and snippets.

@koemu
Created July 24, 2014 05:32
Show Gist options
  • Save koemu/539d8307f55a21d79091 to your computer and use it in GitHub Desktop.
Save koemu/539d8307f55a21d79091 to your computer and use it in GitHub Desktop.
Get running KVM guests for Mackerel
#!/bin/bash
DATE=$(date +%s)
echo -e "kvm.guest.state.running\t$(virsh list --uuid | sed '/^$/d' | wc -l)\t${DATE}"
echo -e "kvm.guest.state.inactive\t$(virsh list --inactive --uuid | sed '/^$/d'| wc -l)\t${DATE}"
# Please append this lines to your config file.
[plugin.metrics.kvm_guest_state]
command = "/usr/local/bin/kvm_guest_state_metrics.sh"
type = "metric"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment