X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fvirt.c;h=dff8f71dcb9119c812ad9645f72ea2d5f010b824;hb=eab8493d114c7c209d90ac54edb7c8026c085747;hp=5f87625ab5f758334330bfd388d38abc7fb3ccfc;hpb=83f88a178b310d844db10057b0f17a5039ed6ddc;p=collectd.git diff --git a/src/virt.c b/src/virt.c index 5f87625a..dff8f71d 100644 --- a/src/virt.c +++ b/src/virt.c @@ -547,6 +547,12 @@ lv_read (void) continue; } + if (info.state != VIR_DOMAIN_RUNNING) + { + /* only gather stats for running domains */ + continue; + } + cpu_submit (info.cpuTime, domains[i], "virt_cpu_total"); memory_submit ((gauge_t) info.memory * 1024, domains[i]); @@ -920,6 +926,9 @@ add_interface_device (virDomainPtr dom, const char *path, const char *address, u int new_size = sizeof (interface_devices[0]) * (nr_interface_devices+1); char *path_copy, *address_copy, number_string[15]; + if ((path == NULL) || (address == NULL)) + return EINVAL; + path_copy = strdup (path); if (!path_copy) return -1; @@ -955,6 +964,9 @@ ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath) char *name; int n, r; + if ((domname == NULL) || (devpath == NULL)) + return 0; + n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2); name = malloc (n); if (name == NULL) {