The first step in monitoring virtual machines is to get familiar with the tools to collect metrics on the subsystems we would like to later alert on. In this recipe, we are going to focus on CPU, memory, and block device utilization of the KVM guests. We are also going to learn how to use the QEMU monitoring socket and the QEMU guest agent.
Libvirt exposes a set of calls that the virsh command leverages to gather resource usage information on the specified guest/domain. We are going to monitor and alert on the information collected here in the Monitoring KVM instances with Sensu recipe later in this chapter.