projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1455 from rubenk/configure-ac-remove-dead-code
[collectd.git]
/
src
/
virt.c
diff --git
a/src/virt.c
b/src/virt.c
index
6118c0f
..
6824b13
100644
(file)
--- 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] =
};
static enum plginst_field plugin_instance_format[PLGINST_MAX_FIELDS] =
- { plginst_n
am
e };
+ { plginst_n
on
e };
/* InterfaceFormat. */
enum if_field {
/* InterfaceFormat. */
enum if_field {
@@
-417,8
+417,8
@@
lv_config (const char *key, const char *value)
else if (strcasecmp (fields[i], "uuid") == 0)
hostname_format[i] = hf_uuid;
else {
else if (strcasecmp (fields[i], "uuid") == 0)
hostname_format[i] = hf_uuid;
else {
- sfree (value_copy);
ERROR (PLUGIN_NAME " plugin: unknown HostnameFormat field: %s", fields[i]);
ERROR (PLUGIN_NAME " plugin: unknown HostnameFormat field: %s", fields[i]);
+ sfree (value_copy);
return -1;
}
}
return -1;
}
}
@@
-449,13
+449,16
@@
lv_config (const char *key, const char *value)
}
for (i = 0; i < n; ++i) {
}
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;
else {
plugin_instance_format[i] = plginst_name;
else if (strcasecmp (fields[i], "uuid") == 0)
plugin_instance_format[i] = plginst_uuid;
else {
+ ERROR (PLUGIN_NAME " plugin: unknown PluginInstanceFormat field: %s", fields[i]);
sfree (value_copy);
sfree (value_copy);
- ERROR (PLUGIN_NAME " plugin: unknown HostnameFormat field: %s", fields[i]);
return -1;
}
}
return -1;
}
}
@@
-547,6
+550,12
@@
lv_read (void)
continue;
}
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]);
cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
memory_submit ((gauge_t) info.memory * 1024, domains[i]);
@@
-588,7
+597,7
@@
lv_read (void)
}
for (j = 0; j < status; j++) {
}
for (j = 0; j < status; j++) {
- memory_stats_submit ((gauge_t) minfo[j].val, domains[i], minfo[j].tag);
+ memory_stats_submit ((gauge_t) minfo[j].val
* 1024
, domains[i], minfo[j].tag);
}
sfree (minfo);
}
sfree (minfo);
@@
-920,6
+929,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];
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;
path_copy = strdup (path);
if (!path_copy) return -1;
@@
-955,6
+967,9
@@
ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath)
char *name;
int n, r;
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) {
n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2);
name = malloc (n);
if (name == NULL) {