X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvirt.c;h=f2acde07348dee0beb15dca40623bdf5fbe94338;hb=9be7c0d4d072bf1a8afce79fa2691a6610c4aeb6;hp=56e44fbd4c8f930b2831ec01b91a22087525ce73;hpb=8eba8c636baa2eb832d1752355558953bd77f302;p=collectd.git diff --git a/src/virt.c b/src/virt.c index 56e44fbd..f2acde07 100644 --- a/src/virt.c +++ b/src/virt.c @@ -138,11 +138,17 @@ static const char *config_keys[] = {"Connection", "Instances", "ExtraStats", "PersistentNotification", + + "ReportBlockDevices", + "ReportNetworkInterfaces", NULL}; /* PersistentNotification is false by default */ static bool persistent_notification = false; +static bool report_block_devices = true; +static bool report_network_interfaces = true; + /* Thread used for handling libvirt notifications events */ static virt_notif_thread_t notif_thread; @@ -1368,6 +1374,16 @@ static int lv_config(const char *key, const char *value) { return 0; } + if (strcasecmp(key, "ReportBlockDevices") == 0) { + report_block_devices = IS_TRUE(value); + return 0; + } + + if (strcasecmp(key, "ReportNetworkInterfaces") == 0) { + report_network_interfaces = IS_TRUE(value); + return 0; + } + /* Unrecognised option. */ return -1; } @@ -2624,10 +2640,12 @@ static int refresh_lists(struct lv_read_instance *inst) { goto cont; /* Block devices. */ - lv_add_block_devices(state, dom, domname, xpath_ctx); + if (report_block_devices) + lv_add_block_devices(state, dom, domname, xpath_ctx); /* Network interfaces. */ - lv_add_network_interfaces(state, dom, domname, xpath_ctx); + if (report_network_interfaces) + lv_add_network_interfaces(state, dom, domname, xpath_ctx); cont: if (xpath_ctx)