[collectd] VMware Guest SDK plugin for Collectd 5

Otis Gospodnetic otis.gospodnetic at gmail.com
Tue Apr 9 18:32:22 CEST 2013


Mmm, nice!

Re:
"
+The VMware plugin collects information exposed to a guest virtual machine
+running on a VMware hypervisor through the VMware Guest SDK.
"

Where could I get some info about what specific information this is?
Is that all the stuff on
http://pubs.vmware.com/vsphere-4-esx-vcenter/index.jsp?topic=/com.vmware.vsphere.dcadmin.doc_41/vsp_dc_admin_guide/performance_metrics/c_performance_metrics.html
?

Thanks,
Otis
--
Solr & ElasticSearch Support
http://sematext.com/





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



More information about the collectd mailing list