From: Ruben Kerkhof Date: Tue, 30 Jun 2015 13:04:11 +0000 (+0200) Subject: virt: Add PluginInstanceFormat none, as default X-Git-Tag: collectd-5.6.0~594 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8fc097046f92322d408505f485834d2a038ebec5;p=collectd.git virt: Add PluginInstanceFormat none, as default Fixes #1100 --- 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;