diff --git a/src/im_mad/remotes/kvm-probes.d/guestagent.conf b/src/im_mad/remotes/kvm-probes.d/guestagent.conf index 95c6dcbbec..0f1a0db012 100644 --- a/src/im_mad/remotes/kvm-probes.d/guestagent.conf +++ b/src/im_mad/remotes/kvm-probes.d/guestagent.conf @@ -4,9 +4,18 @@ # enable or disable monitoring information from the qemu guest agent. :enabled: false # Commands used to gather VM information. -# Each command key will appear on the MONITORING message from the poll probe # The value will be run as a command executed with virsh qemu-agent-command # The $vm_id substring, if existing, will be replaced by the VM ID when the monitoring probes # are looping on each of the VMs on the host. Each command will be run once per VM. +# The expected response for each command is a JSON string with a "return" key. +# The contents of it will appear on the MONITORING message from the poll probe. :commands: :vm_qemu_ping: "one-$vm_id '{\"execute\":\"guest-ping\"}' --timeout 5" + # The first non-loopback address + :vm_ip_address: > + one-$vm_id '{"execute":"guest-network-get-interfaces"}' --timeout 5 | + jq '{"return" : [ .return[]."ip-addresses"[]|select(."ip-address-type"=="ipv4" and (."ip-address"|startswith("127.")|not))."ip-address" ][0]}' + # Array of all IP addresses + :vm_ip_address_list: > + one-$vm_id '{"execute":"guest-network-get-interfaces"}' --timeout 5 | + jq '{"return" : [ .return[]."ip-addresses"[]."ip-address" ]}'