From 8fc097046f92322d408505f485834d2a038ebec5 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Tue, 30 Jun 2015 15:04:11 +0200 Subject: [PATCH] virt: Add PluginInstanceFormat none, as default Fixes #1100 --- src/collectd.conf.pod | 12 ++++++------ src/virt.c | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index d20feae8..59247da0 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -7139,17 +7139,17 @@ setting B. B
means use the interface's mac address. This is useful since the interface path might change between reboots of a guest or across migrations. -=item B B +=item B B When the virt plugin logs data, it sets the plugin_instance of the collected -data according to this setting. The default is to use the guest name as provided -by the hypervisor, which is equal to setting B. +data according to this setting. The default is to not set the plugin_instance. +B means use the guest's name as provided by the hypervisor. B means use the guest's UUID. -You can also specify combinations of these fields. For example B -means to concatenate the guest name and UUID (with a literal colon character -between, thus I<"foo:1234-1234-1234-1234">). +You can also specify combinations of the B and B fields. +For example B means to concatenate the guest name and UUID +(with a literal colon character between, thus I<"foo:1234-1234-1234-1234">). =back diff --git a/src/virt.c b/src/virt.c index 663555b9..6824b134 100644 --- a/src/virt.c +++ b/src/virt.c @@ -128,7 +128,7 @@ enum plginst_field { }; static enum plginst_field plugin_instance_format[PLGINST_MAX_FIELDS] = - { plginst_name }; + { plginst_none }; /* InterfaceFormat. */ enum if_field { @@ -449,7 +449,10 @@ lv_config (const char *key, const char *value) } for (i = 0; i < n; ++i) { - if (strcasecmp (fields[i], "name") == 0) + if (strcasecmp (fields[i], "none") == 0) { + plugin_instance_format[i] = plginst_none; + break; + } else if (strcasecmp (fields[i], "name") == 0) plugin_instance_format[i] = plginst_name; else if (strcasecmp (fields[i], "uuid") == 0) plugin_instance_format[i] = plginst_uuid; -- 2.11.0