vhostmd (8) - Linux Manuals
vhostmd: A metrics gathering daemon.
NAME
vhostmd - A metrics gathering daemon.SYNOPSIS
vhostmd [ OPTION ]DESCRIPTION
vhostmd provides a "metrics communication channel" between a host and its hosted virtual machines, allowing limited introspection of host resource usage from within virtual machines. This functionality may be useful in hosting environments, giving virtual machine administrators a limited view of host resource consumption - potentially explaining a performance degradation within the virtual machine.vhostmd will periodically write metrics to a disk. The metrics to write, how often, and where to write them are all adjustable via the /etc/vhostmd/vhostmd.conf configuration file. The disk can then be surfaced read-only to virtual machines using tools provided by the host's virtualization platform.
OPTIONS
- -v, --verbose
- Verbose messages
- -d, --no-daemonize
- Process will not daemonize
- -c, --connect <uri>
- Set the libvirt URI. If unspecified then we connect to the default libvirt hypervisor. It is recommended that you specify this since libvirt's method for choosing the default hypervisor can give unexpected results.
- -u, --user <user>
- Drop root privileges and run as the named non-root user.
- -p, --pid-file <file>
- Specify an alternate path for vhostmd to record its process-id in. Normally /var/run/vhostmd.pid
- -f, --config <file>
- Specify a different configuration file. Normally /etc/vhostmd/vhostmd.conf
CONFIG FILE
At startup, vhostmd reads /etc/vhostmd/vhostmd.conf, if it exists.The default configuration file (listed below) defines a 256Kbyte metrics disk in /dev/shm/vhostmd0, updated every 5 seconds. It also includes a few examples of user-defined metrics, which provide a (currently simplistic) mechanism for extending metrics gathered by vhostmd.
A valid configuration file must contain the root element <vhostmd>.
The <globals> element contains configuration global to vhostmd, such as
the metrics disk path and the metrics refresh interval. The <metrics>
element is a container for all of the <metric> elements. A metric element
is used to define a metric, giving it a name and an action that produces
the metric value.
The supplied vhostmd configuration file provides a useful set of default
metrics to be collected. This can be extended or modified by editing
/etc/vhostmd/vhostmd.conf and changing existing metric definitions or
adding new metric definitions under the metrics container.
Defined metrics begin with the <metric> element, which contains two
attributes: type and context. The type attribute is used to describe the
metric's value type. Supported types are int32, uint32, int64, uint64,
real32, real64, string, group, and xml. group is used when an action returns
more than one metric value. xml is the most flexible type and specifies that
the metric's action returns valid metric XML. The context attribute is used
to indicate whether this is a host or vm metric. Supported contexts are
host and vm.
Currently, the metric element contains 3 elements: name, action, and variable.
The name element defines the metric's name. The action element describes a
command or pipeline of commands used to gather the metric.
Any <action> element can contain the magic token CONNECT which is
replaced with the string "--connect 'uri'" where uri is the libvirt
connection URI (specified on the command line to vhostmd as the -c
option). If it wasn't specified, then the token CONNECT is
substituted with the empty string. This allows you to write virsh
commands like this:
For metrics of vm context, the tokens NAME, VMID, and UUID may be used
where these attributes of a VM are normally provided in a command.
When the metric is sampled, these tokens will be substituted with the
actual name, ID, or UUID of the vm currently being sampled by vhostmd.
If the metric type is xml, action is expected to return valid metric
XML as defined below in "XML Format of Content".
Currently, the disk format is quite simple: a raw, file-backed disk containing a header, immediately followed by metric content.
The header contains the following, all in network-byte order
The busy flag permits simple reader/writer synchronization. The busy flag can be checked for clear, content read into a buffer, and the busy flag checked again for clear to ensure stable content.
The content is an XML document containing default and user-defined metrics. The format is quite similar to the metrics definitions found in the vhostmd configuration file. A notable addition, as illustrated below, is the value element containing the metric's current value.
/etc/vhostmd/vhostmd.dtd
/etc/vhostmd/metric.dtd
<disk>
</disk>
<update_period>5</update_period>
<path>/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts</path>
<metric type="string"
</metric>
<metric type="string"
</metric>
<metric type="uint32"
</metric>
<metric type="uint32"
</metric>
<metric type="uint64"
</metric>
<metric type="uint64"
</metric>
<metric type="uint64"
</metric>
<metric type="uint64"
</metric>
<metric type="uint64"
</metric>
<metric type="group"
</metric>
<metric type="real64"
</metric>
<metric type="real64"
</metric>
<metric type="xml"
</metric>
Metrics Disk Format
XML Format of Content
<metric type='real64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint64'
</metric>
<metric type='uint32'
</metric>
<metric type='uint32'
</metric>
<metric type='string'
</metric>
<metric type='string'
</metric>
<metric type='real64'
</metric>
<metric type='real64'
</metric>
FILES
/etc/vhostmd/vhostmd.conf
AUTHORS