<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 10pt;"><span>I'm a little late replying here... hopefully better off late than never.</span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span>At Cisco, we use this VMware plugin with WebEx Social. It's been deployed on 1000s of VMs without a single issue.</span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color:
transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span>Please by all means create a pull request. I've been meaning to do it but just swamped. Here is a cut/paste of the patch we apply during our RPM build.</span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="background-color: transparent;"><span><font size="2"><div style="background-color: transparent;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 13px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal;">diff -Nur a/AUTHORS b/AUTHORS</div><div style="background-color:
transparent;">--- a/AUTHORS<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:48:45.630039048 +0000</div><div style="background-color: transparent;">+++ b/AUTHORS<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:55:31.746064457 +0000</div><div style="background-color: transparent;">@@ -73,6 +73,9 @@</div><div style="background-color: transparent;"> Edward “Koko” Konetzko <konetzed at quixoticagony.com></div><div style="background-color: transparent;"> - fscache plugin.</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">+Edward Muller <emuller at engineyard.com></div><div style="background-color: transparent;">+ - vmware plugin.</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;"> Fabian Linzberger <e at lefant.net></div><div style="background-color:
transparent;"> - Percentage aggregation for `collectd-nagios'.</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">@@ -91,6 +94,9 @@</div><div style="background-color: transparent;"> Jérôme Renard <jerome.renard at gmail.com></div><div style="background-color: transparent;"> - varnish plugin.</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">+Keith Chambers <chambers_keith at yahoo.com></div><div style="background-color: transparent;">+ - vmware plugin.</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;"> Luboš Staněk <kolektor at atlas.cz></div><div style="background-color: transparent;"> - sensors plugin improvements.</div><div style="background-color: transparent;"> - Time and effort to find a nasty bug in the ntpd-plugin.</div><div
style="background-color: transparent;">diff -Nur a/configure.in b/configure.in</div><div style="background-color: transparent;">--- a/configure.in<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:48:45.628039167 +0000</div><div style="background-color: transparent;">+++ b/configure.in<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 08:10:50.437126429 +0000</div><div style="background-color: transparent;">@@ -4132,6 +4132,39 @@</div><div style="background-color: transparent;"> fi</div><div style="background-color: transparent;"> # }}}</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">+# --with-libvmware {{{</div><div style="background-color: transparent;">+with_libvmware_cflags=""</div><div style="background-color: transparent;">+AC_ARG_WITH(libvmware, [AS_HELP_STRING([--with-libvmware@<:@=PREFIX@:>@], [Path to libvmware.])],</div><div
style="background-color: transparent;">+[</div><div style="background-color: transparent;">+ if test "x$withval" != "xno" && test "x$withval" != "xyes"</div><div style="background-color: transparent;">+ then</div><div style="background-color: transparent;">+ with_libvmware_cflags="-I$withval"</div><div style="background-color: transparent;">+ with_libvmware="yes"</div><div style="background-color: transparent;">+ else</div><div style="background-color: transparent;">+ with_libvmware="$withval"</div><div style="background-color: transparent;">+ fi</div><div style="background-color: transparent;">+],</div><div style="background-color: transparent;">+[</div><div style="background-color: transparent;">+ with_libvmware="yes"</div><div style="background-color: transparent;">+])</div><div
style="background-color: transparent;">+if test "x$with_libvmware" = "xyes"</div><div style="background-color: transparent;">+then</div><div style="background-color: transparent;">+ SAVE_CFLAGS="$CFLAGS"</div><div style="background-color: transparent;">+ CFLAGS="$CFLAGS $with_libvmware_cflags"</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ AC_CHECK_HEADERS(vmGuestLib.h, [with_libvmware="yes"], [with_libvmware="no (vmGuestLib.h not found)"])</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ CFLAGS="$SAVE_CFLAGS"</div><div style="background-color: transparent;">+fi</div><div style="background-color: transparent;">+if test "x$with_libvmware" = "xyes"</div><div style="background-color: transparent;">+then</div><div style="background-color: transparent;">+
BUILD_WITH_LIBVMWARE_CFLAGS="$with_libvmware_cflags"</div><div style="background-color: transparent;">+ AC_SUBST(BUILD_WITH_LIBVMWARE_CFLAGS)</div><div style="background-color: transparent;">+ #AC_DEFINE(HAVE_LIBVMWARE, 1, [Define if libvmware is present and usable.])</div><div style="background-color: transparent;">+fi</div><div style="background-color: transparent;">+AM_CONDITIONAL(BUILD_WITH_LIBVMWARE, test "x$with_libvmware" = "xyes")</div><div style="background-color: transparent;">+# }}}</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;"> # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{</div><div style="background-color: transparent;"> with_libxml2="no (pkg-config isn't available)"</div><div style="background-color: transparent;"> with_libxml2_cflags=""</div><div style="background-color: transparent;">@@ -4500,6 +4533,7 @@</div><div
style="background-color: transparent;"> plugin_users="no"</div><div style="background-color: transparent;"> plugin_uptime="no"</div><div style="background-color: transparent;"> plugin_vmem="no"</div><div style="background-color: transparent;">+plugin_vmware="no"</div><div style="background-color: transparent;"> plugin_vserver="no"</div><div style="background-color: transparent;"> plugin_wireless="no"</div><div style="background-color: transparent;"> plugin_zfs_arc="no"</div><div style="background-color: transparent;">@@ -4528,6 +4562,7 @@</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre"> </span>plugin_tcpconns="yes"</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre"> </span>plugin_thermal="yes"</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre">
</span>plugin_uptime="yes"</div><div style="background-color: transparent;">+<span class="Apple-tab-span" style="white-space:pre"> </span>plugin_vmware="yes"</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre"> </span>plugin_vmem="yes"</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre"> </span>plugin_vserver="yes"</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre"> </span>plugin_wireless="yes"</div><div style="background-color: transparent;">@@ -4877,6 +4912,7 @@</div><div style="background-color: transparent;"> AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])</div><div style="background-color: transparent;"> AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache
statistics])</div><div style="background-color: transparent;"> AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])</div><div style="background-color: transparent;">+AC_PLUGIN([vmware], [$with_libvmware], [VMware client statistics])</div><div style="background-color: transparent;"> AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])</div><div style="background-color: transparent;"> AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])</div><div style="background-color: transparent;"> AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])</div><div style="background-color: transparent;">@@ -5090,6 +5126,7 @@</div><div style="background-color: transparent;"> libupsclient . . . .
$with_libupsclient</div><div style="background-color: transparent;"> libvarnish . . . . . $with_libvarnish</div><div style="background-color: transparent;"> libvirt . . . . . . . $with_libvirt</div><div style="background-color: transparent;">+ libvmware . . . . . . $with_libvmware</div><div style="background-color: transparent;"> libxml2 . . . . . . . $with_libxml2</div><div style="background-color: transparent;"> libxmms . . . . . . . $with_libxmms</div><div style="background-color: transparent;"> libyajl . . . . . . . $with_libyajl</div><div style="background-color: transparent;">@@ -5208,6 +5245,7 @@</div><div style="background-color: transparent;"> uuid . . . . . . . . $enable_uuid</div><div style="background-color: transparent;"> varnish . . . . . . . $enable_varnish</div><div
style="background-color: transparent;"> vmem . . . . . . . . $enable_vmem</div><div style="background-color: transparent;">+ vmware . . . . . . . $enable_vmware</div><div style="background-color: transparent;"> vserver . . . . . . . $enable_vserver</div><div style="background-color: transparent;"> wireless . . . . . . $enable_wireless</div><div style="background-color: transparent;"> write_graphite . . . $enable_write_graphite</div><div style="background-color: transparent;">diff -Nur a/README b/README</div><div style="background-color: transparent;">--- a/README<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:48:45.630039048 +0000</div><div style="background-color: transparent;">+++ b/README<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:56:13.919061500 +0000</div><div
style="background-color: transparent;">@@ -309,6 +309,10 @@</div><div style="background-color: transparent;"> - varnish</div><div style="background-color: transparent;"> Various statistics from Varnish, an HTTP accelerator.</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">+ - vmware</div><div style="background-color: transparent;">+ The VMware plugin collects information exposed to a guest virtual</div><div style="background-color: transparent;">+ machine running on a VMware hypervisor through the VMware Guest SDK.</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;"> - vmem</div><div style="background-color: transparent;"> Virtual memory statistics, e. g. the number of page-ins/-outs or the</div><div
style="background-color: transparent;"> number of pagefaults.</div><div style="background-color: transparent;">diff -Nur a/src/collectd.conf.in b/src/collectd.conf.in</div><div style="background-color: transparent;">--- a/src/collectd.conf.in<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:48:45.626412735 +0000</div><div style="background-color: transparent;">+++ b/src/collectd.conf.in<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 08:02:59.440063698 +0000</div><div style="background-color: transparent;">@@ -145,6 +145,7 @@</div><div style="background-color: transparent;"> #@BUILD_PLUGIN_UUID_TRUE@LoadPlugin uuid</div><div style="background-color: transparent;"> #@BUILD_PLUGIN_VARNISH_TRUE@LoadPlugin varnish</div><div style="background-color: transparent;"> #@BUILD_PLUGIN_VMEM_TRUE@LoadPlugin vmem</div><div style="background-color:
transparent;">+#@BUILD_PLUGIN_VMWARE_TRUE@LoadPlugin vmware</div><div style="background-color: transparent;"> #@BUILD_PLUGIN_VSERVER_TRUE@LoadPlugin vserver</div><div style="background-color: transparent;"> #@BUILD_PLUGIN_WIRELESS_TRUE@LoadPlugin wireless</div><div style="background-color: transparent;"> #@BUILD_PLUGIN_WRITE_GRAPHITE_TRUE@LoadPlugin write_graphite</div><div style="background-color: transparent;">diff -Nur a/src/collectd.conf.pod b/src/collectd.conf.pod</div><div style="background-color: transparent;">--- a/src/collectd.conf.pod<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:48:45.624412145 +0000</div><div style="background-color: transparent;">+++ b/src/collectd.conf.pod<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 08:03:52.798162943 +0000</div><div style="background-color: transparent;">@@ -4767,6 +4767,11 @@</div><div style="background-color:
transparent;"> </div><div style="background-color: transparent;"> The Varnish plugin collects information about Varnish, an HTTP accelerator.</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">+=head2 Plugin C<vmware></div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+The VMware plugin collects information exposed to a guest virtual machine</div><div style="background-color: transparent;">+running on a VMware hypervisor through the VMware Guest SDK.</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;"> =over 4</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;"> =item B<CollectCache> B<true>|B<false></div><div style="background-color: transparent;">diff -Nur a/src/Makefile.am b/src/Makefile.am</div><div
style="background-color: transparent;">--- a/src/Makefile.am<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 07:48:45.621412744 +0000</div><div style="background-color: transparent;">+++ b/src/Makefile.am<span class="Apple-tab-span" style="white-space:pre"> </span>2012-04-02 08:02:29.167082565 +0000</div><div style="background-color: transparent;">@@ -1230,6 +1230,15 @@</div><div style="background-color: transparent;"> collectd_DEPENDENCIES += varnish.la</div><div style="background-color: transparent;"> endif</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">+if BUILD_PLUGIN_VMWARE</div><div style="background-color: transparent;">+pkglib_LTLIBRARIES += vmware.la</div><div style="background-color: transparent;">+vmware_la_SOURCES = vmware.c</div><div style="background-color: transparent;">+vmware_la_LDFLAGS = -module -avoid-version</div><div style="background-color:
transparent;">+vmware_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBVMWARE_CFLAGS)</div><div style="background-color: transparent;">+collectd_LDADD += "-dlopen" vmware.la</div><div style="background-color: transparent;">+collectd_DEPENDENCIES += vmware.la</div><div style="background-color: transparent;">+endif</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;"> if BUILD_PLUGIN_VMEM</div><div style="background-color: transparent;"> pkglib_LTLIBRARIES += vmem.la</div><div style="background-color: transparent;"> vmem_la_SOURCES = vmem.c</div><div style="background-color: transparent;">diff -Nur a/src/vmware.c b/src/vmware.c</div><div style="background-color: transparent;">--- a/src/vmware.c<span class="Apple-tab-span" style="white-space:pre"> </span>1970-01-01 00:00:00.000000000 +0000</div><div style="background-color: transparent;">+++ b/src/vmware.c<span class="Apple-tab-span"
style="white-space:pre"> </span>2012-04-02 07:48:56.488169649 +0000</div><div style="background-color: transparent;">@@ -0,0 +1,332 @@</div><div style="background-color: transparent;">+/**</div><div style="background-color: transparent;">+ * collectd - src/vmware.c</div><div style="background-color: transparent;">+ * Copyright (C) 2010 Edward Muller</div><div style="background-color: transparent;">+ * Copyright (C) 2011 Keith Chambers</div><div style="background-color: transparent;">+ *</div><div style="background-color: transparent;">+ * This program is free software; you can redistribute it and/or modify it</div><div style="background-color: transparent;">+ * under the terms of the GNU Lesser General Public License as published by</div><div style="background-color: transparent;">+ * the Free Software Foundation; only version 2.1 of the License is</div><div style="background-color: transparent;">+ * applicable.</div><div
style="background-color: transparent;">+ *</div><div style="background-color: transparent;">+ * This program is distributed in the hope that it will be useful, but</div><div style="background-color: transparent;">+ * WITHOUT ANY WARRANTY; without even the implied warranty of</div><div style="background-color: transparent;">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</div><div style="background-color: transparent;">+ * Lesser General Public License for more details.</div><div style="background-color: transparent;">+ *</div><div style="background-color: transparent;">+ * You should have received a copy of the GNU Lesser General Public License</div><div style="background-color: transparent;">+ * along with this program; if not, write to the Free Software Foundation,</div><div style="background-color: transparent;">+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</div><div style="background-color:
transparent;">+ *</div><div style="background-color: transparent;">+ * Authors:</div><div style="background-color: transparent;">+ * Edward Muller <emuller at engineyard.com></div><div style="background-color: transparent;">+ * Keith Chambers <chambers_keith at yahoo.com></div><div style="background-color: transparent;">+ **/</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+#include "collectd.h"</div><div style="background-color: transparent;">+#include "common.h"</div><div style="background-color: transparent;">+#include "plugin.h"</div><div style="background-color: transparent;">+#include <dlfcn.h></div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+#include <vmGuestLib.h></div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+/* functions to dynamically load from the
GuestLib library */</div><div style="background-color: transparent;">+char const * (*GuestLib_GetErrorText)(VMGuestLibError);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_OpenHandle)(VMGuestLibHandle*);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_CloseHandle)(VMGuestLibHandle);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_UpdateInfo)(VMGuestLibHandle handle);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetSessionId)(VMGuestLibHandle handle, VMSessionId *id);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetElapsedMs)(VMGuestLibHandle handle, uint64 *elapsedMs);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetCpuUsedMs)(VMGuestLibHandle handle, uint64 *cpuUsedMs);</div><div style="background-color: transparent;">+VMGuestLibError
(*GuestLib_GetCpuStolenMs)(VMGuestLibHandle handle, uint64 *cpuStolenMs);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetCpuReservationMHz)(VMGuestLibHandle handle, uint32 *cpuReservationMHz);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetCpuLimitMHz)(VMGuestLibHandle handle, uint32 *cpuLimitMHz);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetCpuShares)(VMGuestLibHandle handle, uint32 *cpuShares);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemUsedMB)(VMGuestLibHandle handle, uint32 *memUsedMB);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemMappedMB)(VMGuestLibHandle handle, uint32 *memMappedMB);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemActiveMB)(VMGuestLibHandle handle, uint32 *memActiveMB);</div><div style="background-color:
transparent;">+VMGuestLibError (*GuestLib_GetMemBalloonedMB)(VMGuestLibHandle handle, uint32 *memBalloonedMB);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemSwappedMB)(VMGuestLibHandle handle, uint32 *memSwappedMB);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemReservationMB)(VMGuestLibHandle handle, uint32 *memReservationMB);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemLimitMB)(VMGuestLibHandle handle, uint32 *memLimitMB);</div><div style="background-color: transparent;">+VMGuestLibError (*GuestLib_GetMemShares)(VMGuestLibHandle handle, uint32 *memShares);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+/* handle for use with shared library */</div><div style="background-color: transparent;">+static VMGuestLibHandle glHandle;</div><div style="background-color: transparent;">+</div><div
style="background-color: transparent;">+/* used when converting megabytes to bytes for memory counters */</div><div style="background-color: transparent;">+#define BYTES_PER_MB 1024*1024</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+/* macro to load a single GuestLib function from the shared library */</div><div style="background-color: transparent;">+#define LOAD_ONE_FUNC(funcname) \</div><div style="background-color: transparent;">+ do { \</div><div style="background-color: transparent;">+ funcname = dlsym(dlHandle, "VM" #funcname); \</div><div style="background-color:
transparent;">+ if ((dlErrStr = dlerror()) != NULL) { \</div><div style="background-color: transparent;">+ ERROR ("Failed to load \'%s\': \'%s\'\n", \</div><div style="background-color: transparent;">+ #funcname, dlErrStr); \</div><div style="background-color: transparent;">+ return (-1); \</div><div style="background-color: transparent;">+ } \</div><div
style="background-color: transparent;">+ } while (0)</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+_Bool</div><div style="background-color: transparent;">+static LoadFunctions(void)</div><div style="background-color: transparent;">+{</div><div style="background-color: transparent;">+ void *dlHandle = NULL;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* first try to load the shared library */</div><div style="background-color: transparent;">+ char const *dlErrStr;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ dlHandle = dlopen("libvmGuestLib.so", RTLD_NOW);</div><div style="background-color: transparent;">+ if (!dlHandle) {</div><div style="background-color: transparent;">+ dlErrStr =
dlerror();</div><div style="background-color: transparent;">+ ERROR ("dlopen failed: \'%s\'\n", dlErrStr);</div><div style="background-color: transparent;">+ return FALSE;</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* Load all the individual library functions */</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetErrorText);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_OpenHandle);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_CloseHandle);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_UpdateInfo);</div><div style="background-color: transparent;">+
LOAD_ONE_FUNC(GuestLib_GetSessionId);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetElapsedMs);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetCpuStolenMs);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetCpuUsedMs);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetCpuReservationMHz);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetCpuLimitMHz);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetCpuShares);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemReservationMB);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemLimitMB);</div><div style="background-color: transparent;">+
LOAD_ONE_FUNC(GuestLib_GetMemShares);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemMappedMB);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemActiveMB);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemBalloonedMB);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemSwappedMB);</div><div style="background-color: transparent;">+ LOAD_ONE_FUNC(GuestLib_GetMemUsedMB);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ return TRUE;</div><div style="background-color: transparent;">+}</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+static int vmware_init (void)</div><div style="background-color: transparent;">+{</div><div style="background-color:
transparent;">+ VMGuestLibError glError;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ if (!LoadFunctions()) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Unable to load GuestLib functions");</div><div style="background-color: transparent;">+ return (-1);</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* try to load the library */</div><div style="background-color: transparent;">+ glError = GuestLib_OpenHandle(&glHandle);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin:
OpenHandle failed: %s", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ return (-1);</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ return (0);</div><div style="background-color: transparent;">+}</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+static void submit_vmw_counter (const char *type, const char *type_inst,</div><div style="background-color: transparent;">+<span class="Apple-tab-span" style="white-space:pre"> </span>derive_t value)</div><div style="background-color: transparent;">+{</div><div style="background-color: transparent;">+ value_t values[1];</div><div style="background-color: transparent;">+ value_list_t vl = VALUE_LIST_INIT;</div><div style="background-color:
transparent;">+</div><div style="background-color: transparent;">+ values[0].derive = value;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ vl.values = values;</div><div style="background-color: transparent;">+ vl.values_len = 1;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));</div><div style="background-color: transparent;">+ sstrncpy (vl.plugin, "vmware", sizeof (vl.plugin));</div><div style="background-color: transparent;">+ sstrncpy (vl.type, type, sizeof (vl.type));</div><div style="background-color: transparent;">+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+
plugin_dispatch_values (&vl);</div><div style="background-color: transparent;">+}</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+static void submit_vmw_gauge (const char *type, const char *type_inst,</div><div style="background-color: transparent;">+ gauge_t value)</div><div style="background-color: transparent;">+{</div><div style="background-color: transparent;">+ value_t values[1];</div><div style="background-color: transparent;">+ value_list_t vl = VALUE_LIST_INIT;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ values[0].gauge = value;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ vl.values = values;</div><div
style="background-color: transparent;">+ vl.values_len = 1;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));</div><div style="background-color: transparent;">+ sstrncpy (vl.plugin, "vmware", sizeof (vl.plugin));</div><div style="background-color: transparent;">+ sstrncpy (vl.type, type, sizeof (vl.type));</div><div style="background-color: transparent;">+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ plugin_dispatch_values (&vl);</div><div style="background-color: transparent;">+}</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+static int vmware_read (void)</div><div style="background-color:
transparent;">+{</div><div style="background-color: transparent;">+ VMGuestLibError glError;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* cpu */</div><div style="background-color: transparent;">+ uint64 cpu_elapsed_ms = 0;</div><div style="background-color: transparent;">+ uint64 cpu_used_ms = 0;</div><div style="background-color: transparent;">+ uint64 cpu_stolen_ms = 0;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* cpu (quality of service) */</div><div style="background-color: transparent;">+ uint32 cpu_reservation_mhz = 0;</div><div style="background-color: transparent;">+ uint32 cpu_limit_mhz = 0;</div><div style="background-color: transparent;">+ uint32 cpu_shares = 0;</div><div style="background-color:
transparent;">+</div><div style="background-color: transparent;">+ /* memory */</div><div style="background-color: transparent;">+ uint32 mem_used_mb = 0;</div><div style="background-color: transparent;">+ uint32 mem_mapped_mb = 0;</div><div style="background-color: transparent;">+ uint32 mem_active_mb = 0;</div><div style="background-color: transparent;">+ uint32 mem_ballooned_mb = 0;</div><div style="background-color: transparent;">+ uint32 mem_swapped_mb = 0;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* memory (quality of service) */</div><div style="background-color: transparent;">+ uint32 mem_reservation_mb = 0;</div><div style="background-color: transparent;">+ uint32 mem_limit_mb = 0;</div><div style="background-color: transparent;">+ uint32 mem_shares =
0;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ VMSessionId session_id = 0;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* attempt to retrieve info from the host */</div><div style="background-color: transparent;">+ VMSessionId tmp_session;</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ glError = GuestLib_UpdateInfo(glHandle);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: VMGuestLib_UpdateInfo returned error: %s", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ return (-1);</div><div style="background-color:
transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* retrieve and check session_id */</div><div style="background-color: transparent;">+ glError = GuestLib_GetSessionId(glHandle, &tmp_session);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: VMGuestLib_GetSessionId returned error: %s", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ return (-1);</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ if (tmp_session == 0) {</div><div style="background-color: transparent;">+
ERROR ("vmware guest plugin: VMGuestLib_GetSessionId returned error: 0");</div><div style="background-color: transparent;">+ return (-1);</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ if (session_id == 0) {</div><div style="background-color: transparent;">+ session_id = tmp_session;</div><div style="background-color: transparent;">+ INFO ("vmware guest plugin: initial session_id is %#"PRIx64, (uint64_t) session_id);</div><div style="background-color: transparent;">+ } else if (tmp_session != session_id) {</div><div style="background-color: transparent;">+ session_id = tmp_session;</div><div style="background-color: transparent;">+ INFO ("vmware guest
plugin: session_id changed to %#"PRIx64, (uint64_t) session_id);</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetElapsedMs */</div><div style="background-color: transparent;">+ glError = GuestLib_GetElapsedMs(glHandle, &cpu_elapsed_ms);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get elapsed ms: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_counter ("cpu", "elapsed_ms", (derive_t) cpu_elapsed_ms);</div><div style="background-color: transparent;">+</div><div style="background-color:
transparent;">+ /* GetCpuUsedMs */</div><div style="background-color: transparent;">+ glError = GuestLib_GetCpuUsedMs(glHandle, &cpu_used_ms);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get used ms: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_counter ("cpu", "used_ms", (derive_t) cpu_used_ms);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetCpuStolenMs */</div><div style="background-color: transparent;">+ glError = GuestLib_GetCpuStolenMs(glHandle, &cpu_stolen_ms);</div><div style="background-color: transparent;">+
if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get CPU stolen: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION) {</div><div style="background-color: transparent;">+ cpu_stolen_ms = 0;</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_counter ("cpu", "stolen_ms", (derive_t) cpu_stolen_ms);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetCpuReservationMHz */ </div><div style="background-color: transparent;">+ glError =
GuestLib_GetCpuReservationMHz(glHandle, &cpu_reservation_mhz);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get CPU reservation: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("cpu", "reservation_mhz", (gauge_t) cpu_reservation_mhz);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetCpuLimitMHz */</div><div style="background-color: transparent;">+ glError = GuestLib_GetCpuLimitMHz(glHandle, &cpu_limit_mhz);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color:
transparent;">+ ERROR ("vmware guest plugin: Failed to get CPU limit: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("cpu", "limit_mhz", (gauge_t) cpu_limit_mhz);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetCpuShares */</div><div style="background-color: transparent;">+ glError = GuestLib_GetCpuShares(glHandle, &cpu_shares);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get cpu shares: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div
style="background-color: transparent;">+ submit_vmw_gauge ("cpu", "shares", (gauge_t) cpu_shares);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetMemUsedMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemUsedMB(glHandle, &mem_used_mb);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get used mem: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "used_mb", BYTES_PER_MB * (gauge_t) mem_used_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+
/* GetMemMappedMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemMappedMB(glHandle, &mem_mapped_mb);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get mapped mem: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "mapped_mb", BYTES_PER_MB * (gauge_t) mem_mapped_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetMemActiveMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemActiveMB(glHandle, &mem_active_mb);</div><div style="background-color: transparent;">+
if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get active mem: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "active_mb", BYTES_PER_MB * (gauge_t) mem_active_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetMemBalloonedMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemBalloonedMB(glHandle, &mem_ballooned_mb);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get ballooned mem: %s\n",
GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "ballooned_mb", BYTES_PER_MB * (gauge_t) mem_ballooned_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetMemSwappedMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemSwappedMB(glHandle, &mem_swapped_mb);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get swapped mem: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory",
"swapped_mb", BYTES_PER_MB * (gauge_t) mem_swapped_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetMemReservationMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemReservationMB(glHandle, &mem_reservation_mb);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get mem reservation: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "reservation_mb", BYTES_PER_MB * (gauge_t) mem_reservation_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /*
GetMemLimitMB */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemLimitMB(glHandle, &mem_limit_mb);</div><div style="background-color: transparent;">+ if (glError != VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get mem limit: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "limit_mb", BYTES_PER_MB * (gauge_t) mem_limit_mb);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ /* GetMemShares */</div><div style="background-color: transparent;">+ glError = GuestLib_GetMemShares(glHandle, &mem_shares);</div><div style="background-color: transparent;">+ if (glError
!= VMGUESTLIB_ERROR_SUCCESS) {</div><div style="background-color: transparent;">+ ERROR ("vmware guest plugin: Failed to get mem shares: %s\n", GuestLib_GetErrorText(glError));</div><div style="background-color: transparent;">+ mem_shares = 0;</div><div style="background-color: transparent;">+ }</div><div style="background-color: transparent;">+ submit_vmw_gauge ("memory", "shares", (gauge_t) mem_shares);</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+ return (0);</div><div style="background-color: transparent;">+}</div><div style="background-color: transparent;">+</div><div style="background-color: transparent;">+void module_register (void)</div><div style="background-color: transparent;">+{</div><div style="background-color: transparent;">+ plugin_register_init ("vmware",
vmware_init);</div><div style="background-color: transparent;">+ plugin_register_read ("vmware", vmware_read);</div><div style="background-color: transparent;">+}</div></font></span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><pre style="word-wrap: break-word; white-space: pre-wrap;"><br></pre></span></div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 10pt;"><br></div> <div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Jesse Reynolds <jesse@bulletproof.net><br> <b><span style="font-weight:
bold;">To:</span></b> collectd@verplant.org <br><b><span style="font-weight: bold;">Cc:</span></b> chambers_keith@yahoo.com <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June 6, 2012 8:10 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [collectd] VMware Guest SDK plugin for Collectd 5<br> </font> </div> <br>
So there's this patch on gerrit to add a VMware plugin, which is looking pretty appealing to me:<br><br><a href="https://collectd.org/gerrit/#change,25" target="_blank">https://collectd.org/gerrit/#change,25</a><br><br>It's been reviewed by Florian, changes made by Keith, and then favourably reviewed again by Florian. ... I'm thinking of putting the patch in a pull request to make it easier to merge in, unless you want to do this Keith? <br><br>Jesse<br><br><br><br> </div> </div> </div></body></html>