uuid plugin: Add a plugin which sets the hostname to an UUID.
Florian Forster wrote:
> Just out of curiosity: Why don't hostnames work for you?
For guests there's the question of what we put in the hostname field. The
previous plugin (libvirtstats) puts the guest's name in this field, but there
are some problems with this:
physicalserver1 <--- (hostname of physical server)
|
\--- database <--- (name of guest)
\--- web
physicalserver2
|
\--- database
\--- web
coldbackupserver
|
(no guests)
Guest names aren't really unique. Different physical servers may have guests
with overlapping names as in the example above. Also guest names aren't fixed.
Xen in particular renames guests at will. For example if a guest is about to
migrate then Xen renames the guest as 'migrating-foo' and if the guest is about
to shutdown Xen renames it as 'Zombie-foo'. The administrator of the physical
server can also rename guests.
While you're migrating you'll have an intermediate situation like this:
physicalserver1
|
\--- migrating-database
\--- migrating-web |
| migration
coldbackupserver |
| V
\--- database
\--- web
During live migrations the old instance ('migrating-foo') is still running.
The UUID is unique across physical servers, and is copied by migration and
preserved across shutdowns so if you care about which guest your stats "really"
came from then only the UUID tells you this.
Guests also have a hostname which is separate from the guest's name (the
guest's name is stored in the hypervisor, the hostname is stored inside the
guest's kernel). However it's not feasible to access the guest's hostname from
the hypervisor since this would involve some sort of snooping into the guest
kernel. The guest might be running Windows or FreeBSD etc. The only feasible
way to get this is to run an instance of collectd inside each guest, but then
the uuid plugin will also work in this scenario and can get the UUID since it
is exposed inside the guest either through an emulated BIOS or in
/sys/hypervisor/uuid.
Rich.
Signed-off-by: Florian Forster <octo@huhu.verplant.org>