Hostinfo Configuration
Enabling hostinfo per host
The hostinfo feature can be enabled or disabled globally by turning the hostinfod (daemon) on or off, using chkconfig, ie:
Enable:
chkconfig hostinfo on service hostinfo start
Disable:
chkconfig hostinfo off service hostinfo stop
List current status:
chkconfig --list hostinfo service hostinfo status
Enabling hostinfo per guest
The hostinfo feature must also be enabled for each guest. Administrators will do this using virt-install (at guest installation), virt-manager (for existing guests), or a custom command line tool. What these programs actually do is to create or remove a <serial/> clause in the guest's libvirt XML configuration, which looks like this:
<serial type='unix'> <source mode='bind' path='/var/lib/hostinfo/$driver-$name'/> <target port='1'/> </serial>
where $driver and $name are replaced with the domain's driver (eg. qemu) and name.
The target port will default to 1 (ie. ttyS1 / COM2) but could have other values if this port is already used.
A guest is reckoned to have hostinfo enabled if and only if there is a <serial/> clause, with a source path attribute starting with '/var/lib/hostinfo/'.
It is an error for a guest to have more than one hostinfo serial port. It is also an error if the path does not contain the correct $driver and $name.
If no fine-tuning is done (see below), the guest gets a selection of statistics, and is allowed to query the host at most once per second.
Fine-tuning hostinfo configuration
Which statistics are made available to guests and how often they may query is determined by fine-tuning through the daemon configuration file:
/etc/hostinfo/hostinfo.conf
This file has a simple format, driver-name pairs, wildcards, along with a set of rules which apply to those. The daemon consults this list and uses the first match.
qemu-myguest: # Rule applies to qemu/KVM domain called 'myguest' interval = 60 # May only query once per 60 seconds physcpus = 0 # May not see physical CPUs qemu-*: # Rule applies to all other qemu/KVM domains interval = 30 # May only query once per 30 seconds *: # Default rule, any not matched above interval = 1 # May query up to once per second physcpus = 1 # May query physical CPUs
The wildcard matches the names of the Unix domain sockets in /var/lib/hostinfo/ directory.
There is no need to restart the daemon after changing this file. The daemon notices any file changes and uses them immediately.