summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e277e04)
raw | patch | inline | side by side (parent: e277e04)
author | Johan Wirén <johan.wiren.se@gmail.com> | |
Wed, 6 Feb 2013 22:37:00 +0000 (23:37 +0100) | ||
committer | Johan Wirén <johan.wiren.se@gmail.com> | |
Thu, 21 Feb 2013 18:07:43 +0000 (19:07 +0100) |
README | patch | blob | history | |
src/libvirt.c | patch | blob | history |
index a8ec07b036b96cdeb166def0deb32695130c3131..77ea6ff2a85087a813494512a5ec73afd3cbb469 100644 (file)
--- a/README
+++ b/README
technique built into IBM's POWER processors.
- libvirt
- CPU, disk and network I/O statistics from virtual machines.
+ CPU, memory, disk and network I/O statistics from virtual machines.
- madwifi
Queries very detailed usage statistics from wireless LAN adapters and
diff --git a/src/libvirt.c b/src/libvirt.c
index c53a81d4b5d1e4261667954b079d26e36a797e07..6b0cf9a43920f2a1300ce1340198f4b06130e51d 100644 (file)
--- a/src/libvirt.c
+++ b/src/libvirt.c
vl->host[sizeof (vl->host) - 1] = '\0';
} /* void init_value_list */
+static void
+memory_submit (unsigned long memory, virDomainPtr dom, const char *type)
+{
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
+
+ init_value_list (&vl, dom);
+
+ values[0].gauge = memory;
+
+ vl.values = values;
+ vl.values_len = 1;
+
+ sstrncpy (vl.type, type, sizeof (vl.type));
+
+ plugin_dispatch_values (&vl);
+}
+
static void
cpu_submit (unsigned long long cpu_time,
virDomainPtr dom, const char *type)
interface_devices[i].path);
#endif
- /* Get CPU usage, VCPU usage for each domain. */
+ /* Get CPU usage, memory, VCPU usage for each domain. */
for (i = 0; i < nr_domains; ++i) {
virDomainInfo info;
virVcpuInfoPtr vinfo = NULL;
}
cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
+ memory_submit (info.memory, domains[i], "memory");
vinfo = malloc (info.nrVirtCpu * sizeof (vinfo[0]));
if (vinfo == NULL) {