9 #include "vmGuestLib.h"
11 /* Functions to dynamically load from the GuestLib library. */
12 char const * (*GuestLib_GetErrorText)(VMGuestLibError);
13 VMGuestLibError (*GuestLib_OpenHandle)(VMGuestLibHandle*);
14 VMGuestLibError (*GuestLib_CloseHandle)(VMGuestLibHandle);
15 VMGuestLibError (*GuestLib_UpdateInfo)(VMGuestLibHandle handle);
16 VMGuestLibError (*GuestLib_GetSessionId)(VMGuestLibHandle handle,
18 VMGuestLibError (*GuestLib_GetCpuReservationMHz)(VMGuestLibHandle handle,
19 uint32 *cpuReservationMHz);
20 VMGuestLibError (*GuestLib_GetCpuLimitMHz)(VMGuestLibHandle handle, uint32 *cpuLimitMHz);
21 VMGuestLibError (*GuestLib_GetCpuShares)(VMGuestLibHandle handle, uint32 *cpuShares);
22 VMGuestLibError (*GuestLib_GetCpuUsedMs)(VMGuestLibHandle handle, uint64 *cpuUsedMs);
23 VMGuestLibError (*GuestLib_GetHostProcessorSpeed)(VMGuestLibHandle handle, uint32 *mhz);
24 VMGuestLibError (*GuestLib_GetMemReservationMB)(VMGuestLibHandle handle,
25 uint32 *memReservationMB);
26 VMGuestLibError (*GuestLib_GetMemLimitMB)(VMGuestLibHandle handle, uint32 *memLimitMB);
27 VMGuestLibError (*GuestLib_GetMemShares)(VMGuestLibHandle handle, uint32 *memShares);
28 VMGuestLibError (*GuestLib_GetMemMappedMB)(VMGuestLibHandle handle,
30 VMGuestLibError (*GuestLib_GetMemActiveMB)(VMGuestLibHandle handle, uint32 *memActiveMB);
31 VMGuestLibError (*GuestLib_GetMemOverheadMB)(VMGuestLibHandle handle,
32 uint32 *memOverheadMB);
33 VMGuestLibError (*GuestLib_GetMemBalloonedMB)(VMGuestLibHandle handle,
34 uint32 *memBalloonedMB);
35 VMGuestLibError (*GuestLib_GetMemSwappedMB)(VMGuestLibHandle handle,
36 uint32 *memSwappedMB);
37 VMGuestLibError (*GuestLib_GetMemSharedMB)(VMGuestLibHandle handle,
39 VMGuestLibError (*GuestLib_GetMemSharedSavedMB)(VMGuestLibHandle handle,
40 uint32 *memSharedSavedMB);
41 VMGuestLibError (*GuestLib_GetMemUsedMB)(VMGuestLibHandle handle,
43 VMGuestLibError (*GuestLib_GetElapsedMs)(VMGuestLibHandle handle, uint64 *elapsedMs);
44 VMGuestLibError (*GuestLib_GetResourcePoolPath)(VMGuestLibHandle handle,
47 VMGuestLibError (*GuestLib_GetCpuStolenMs)(VMGuestLibHandle handle,
49 VMGuestLibError (*GuestLib_GetMemTargetSizeMB)(VMGuestLibHandle handle,
50 uint64 *memTargetSizeMB);
51 VMGuestLibError (*GuestLib_GetHostNumCpuCores)(VMGuestLibHandle handle,
52 uint32 *hostNumCpuCores);
53 VMGuestLibError (*GuestLib_GetHostCpuUsedMs)(VMGuestLibHandle handle,
54 uint64 *hostCpuUsedMs);
55 VMGuestLibError (*GuestLib_GetHostMemSwappedMB)(VMGuestLibHandle handle,
56 uint64 *hostMemSwappedMB);
57 VMGuestLibError (*GuestLib_GetHostMemSharedMB)(VMGuestLibHandle handle,
58 uint64 *hostMemSharedMB);
59 VMGuestLibError (*GuestLib_GetHostMemUsedMB)(VMGuestLibHandle handle,
60 uint64 *hostMemUsedMB);
61 VMGuestLibError (*GuestLib_GetHostMemPhysMB)(VMGuestLibHandle handle,
62 uint64 *hostMemPhysMB);
63 VMGuestLibError (*GuestLib_GetHostMemPhysFreeMB)(VMGuestLibHandle handle,
64 uint64 *hostMemPhysFreeMB);
65 VMGuestLibError (*GuestLib_GetHostMemKernOvhdMB)(VMGuestLibHandle handle,
66 uint64 *hostMemKernOvhdMB);
67 VMGuestLibError (*GuestLib_GetHostMemMappedMB)(VMGuestLibHandle handle,
68 uint64 *hostMemMappedMB);
69 VMGuestLibError (*GuestLib_GetHostMemUnmappedMB)(VMGuestLibHandle handle,
70 uint64 *hostMemUnmappedMB);
72 * Handle for use with shared library.
74 void *dlHandle = NULL;
79 VMGuestLibHandle glHandle;
81 VMGuestLibError glError;
84 * Macro to load a single GuestLib function from the shared library.
86 #define LOAD_ONE_FUNC(funcname) \
88 funcname = dlsym(dlHandle, "VM" #funcname); \
89 if ((dlErrStr = dlerror()) != NULL) { \
90 printf("Failed to load \'%s\': \'%s\'\n", \
91 #funcname, dlErrStr); \
100 * First, try to load the shared library.
102 char const *dlErrStr;
104 dlHandle = dlopen("libvmGuestLib.so", RTLD_NOW);
106 dlErrStr = dlerror();
107 printf("dlopen failed: \'%s\'\n", dlErrStr);
111 /* Load all the individual library functions. */
112 LOAD_ONE_FUNC(GuestLib_GetErrorText);
113 LOAD_ONE_FUNC(GuestLib_OpenHandle);
114 LOAD_ONE_FUNC(GuestLib_CloseHandle);
115 LOAD_ONE_FUNC(GuestLib_UpdateInfo);
116 LOAD_ONE_FUNC(GuestLib_GetSessionId);
117 LOAD_ONE_FUNC(GuestLib_GetCpuReservationMHz);
118 LOAD_ONE_FUNC(GuestLib_GetCpuLimitMHz);
119 LOAD_ONE_FUNC(GuestLib_GetCpuShares);
120 LOAD_ONE_FUNC(GuestLib_GetCpuUsedMs);
121 LOAD_ONE_FUNC(GuestLib_GetHostProcessorSpeed);
122 LOAD_ONE_FUNC(GuestLib_GetMemReservationMB);
123 LOAD_ONE_FUNC(GuestLib_GetMemLimitMB);
124 LOAD_ONE_FUNC(GuestLib_GetMemShares);
125 LOAD_ONE_FUNC(GuestLib_GetMemMappedMB);
126 LOAD_ONE_FUNC(GuestLib_GetMemActiveMB);
127 LOAD_ONE_FUNC(GuestLib_GetMemOverheadMB);
128 LOAD_ONE_FUNC(GuestLib_GetMemBalloonedMB);
129 LOAD_ONE_FUNC(GuestLib_GetMemSwappedMB);
130 LOAD_ONE_FUNC(GuestLib_GetMemSharedMB);
131 LOAD_ONE_FUNC(GuestLib_GetMemSharedSavedMB);
132 LOAD_ONE_FUNC(GuestLib_GetMemUsedMB);
133 LOAD_ONE_FUNC(GuestLib_GetElapsedMs);
134 LOAD_ONE_FUNC(GuestLib_GetResourcePoolPath);
135 LOAD_ONE_FUNC(GuestLib_GetCpuStolenMs);
136 LOAD_ONE_FUNC(GuestLib_GetMemTargetSizeMB);
137 LOAD_ONE_FUNC(GuestLib_GetHostNumCpuCores);
138 LOAD_ONE_FUNC(GuestLib_GetHostCpuUsedMs);
139 LOAD_ONE_FUNC(GuestLib_GetHostMemSwappedMB);
140 LOAD_ONE_FUNC(GuestLib_GetHostMemSharedMB);
141 LOAD_ONE_FUNC(GuestLib_GetHostMemUsedMB);
142 LOAD_ONE_FUNC(GuestLib_GetHostMemPhysMB);
143 LOAD_ONE_FUNC(GuestLib_GetHostMemPhysFreeMB);
144 LOAD_ONE_FUNC(GuestLib_GetHostMemKernOvhdMB);
145 LOAD_ONE_FUNC(GuestLib_GetHostMemMappedMB);
146 LOAD_ONE_FUNC(GuestLib_GetHostMemUnmappedMB);
151 static int vmware_init (void)
153 if (!LoadFunctions()) {
154 ERROR ("vmware guest plugin: Unable to load GuistLib functions");
158 /* Try to load the library. */
159 glError = GuestLib_OpenHandle(&glHandle);
160 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
161 ERROR ("OpenHandle failed: %s", GuestLib_GetErrorText(glError));
168 static void vmware_submit_counter (const char *reading, counter_t value)
171 value_list_t vl = VALUE_LIST_INIT;
173 values[0].counter = value;
178 sstrncpy (vl.host, hostname_g, sizeof (vl.host));
179 sstrncpy (vl.plugin, "vmware", sizeof (vl.plugin));
180 sstrncpy (vl.type, reading, sizeof (vl.type));
182 plugin_dispatch_values (&vl);
185 static void vmware_submit_gauge (const char *reading, gauge_t value)
188 value_list_t vl = VALUE_LIST_INIT;
190 values[0].gauge = value;
195 sstrncpy (vl.host, hostname_g, sizeof (vl.host));
196 sstrncpy (vl.plugin, "vmware", sizeof (vl.plugin));
197 sstrncpy (vl.type, reading, sizeof (vl.type));
199 plugin_dispatch_values (&vl);
202 static int vmware_read (void)
205 uint32 cpuReservationMHz = 0;
206 uint32 cpuLimitMHz = 0;
207 uint32 cpuShares = 0;
208 uint64 cpuUsedMs = 0;
210 uint32 memReservationMB = 0;
211 uint32 memLimitMB = 0;
212 uint32 memShares = 0;
213 uint32 memMappedMB = 0;
214 uint32 memActiveMB = 0;
215 uint32 memOverheadMB = 0;
216 uint32 memBalloonedMB = 0;
217 uint32 memSwappedMB = 0;
218 uint32 memSharedMB = 0;
219 uint32 memSharedSavedMB = 0;
220 uint32 memUsedMB = 0;
221 uint64 elapsedMs = 0;
222 uint64 cpuStolenMs = 0;
223 uint64 memTargetSizeMB = 0;
224 uint32 hostNumCpuCores = 0;
225 uint64 hostCpuUsedMs = 0;
226 uint64 hostMemSwappedMB = 0;
227 uint64 hostMemSharedMB = 0;
228 uint64 hostMemUsedMB = 0;
229 uint64 hostMemPhysMB = 0;
230 uint64 hostMemPhysFreeMB = 0;
231 uint64 hostMemKernOvhdMB = 0;
232 uint64 hostMemMappedMB = 0;
233 uint64 hostMemUnmappedMB = 0;
234 VMSessionId sessionId = 0;
236 /* Attempt to retrieve info from the host. */
237 VMSessionId tmpSession;
239 glError = GuestLib_UpdateInfo(glHandle);
240 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
241 ERROR ("UpdateInfo failed: %s", GuestLib_GetErrorText(glError));
245 /* Retrieve and check the session ID */
246 glError = GuestLib_GetSessionId(glHandle, &tmpSession);
247 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
248 ERROR ("Failed to get session ID: %s", GuestLib_GetErrorText(glError));
252 if (tmpSession == 0) {
253 ERROR ("Error: Got zero sessionId from GuestLib");
257 if (sessionId == 0) {
258 sessionId = tmpSession;
259 DEBUG ("Initial session ID is 0x%"FMT64"x", sessionId);
260 } else if (tmpSession != sessionId) {
261 sessionId = tmpSession;
262 DEBUG ("SESSION CHANGED: New session ID is 0x%"FMT64"x\n", sessionId);
265 /* Retrieve all the stats. */
266 /* FIXME: GENERALIZE */
267 glError = GuestLib_GetCpuReservationMHz(glHandle, &cpuReservationMHz);
268 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
269 DEBUG ("Failed to get CPU reservation: %s\n", GuestLib_GetErrorText(glError));
271 value = (gauge_t) cpuReservationMHz;
272 vmware_submit_gauge ("cpu_reservation_mhz", value);
274 glError = GuestLib_GetCpuLimitMHz(glHandle, &cpuLimitMHz);
275 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
276 DEBUG ("Failed to get CPU limit: %s\n", GuestLib_GetErrorText(glError));
278 value = (gauge_t) cpuLimitMHz;
279 vmware_submit_gauge ("cpu_limit_mhz", value);
281 glError = GuestLib_GetCpuShares(glHandle, &cpuShares);
282 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
283 DEBUG ("Failed to get cpu shares: %s\n", GuestLib_GetErrorText(glError));
285 value = (gauge_t) cpuShares;
286 vmware_submit_gauge ("cpu_shares", value);
288 glError = GuestLib_GetCpuUsedMs(glHandle, &cpuUsedMs);
289 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
290 DEBUG ("Failed to get used ms: %s\n", GuestLib_GetErrorText(glError));
292 value = (counter_t) cpuUsedMs;
293 vmware_submit_counter ("cpu_used_ms", value);
295 glError = GuestLib_GetHostProcessorSpeed(glHandle, &hostMHz);
296 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
297 DEBUG ("Failed to get host proc speed: %s\n", GuestLib_GetErrorText(glError));
299 value = (gauge_t) hostMHz;
300 vmware_submit_gauge ("host_processor_speed", value);
302 glError = GuestLib_GetMemReservationMB(glHandle, &memReservationMB);
303 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
304 DEBUG ("Failed to get mem reservation: %s\n", GuestLib_GetErrorText(glError));
306 value = (gauge_t) memReservationMB;
307 vmware_submit_gauge ("memory_reservation_mb", value);
309 glError = GuestLib_GetMemLimitMB(glHandle, &memLimitMB);
310 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
311 DEBUG ("Failed to get mem limit: %s\n", GuestLib_GetErrorText(glError));
313 value = (gauge_t) memLimitMB;
314 vmware_submit_gauge ("memory_limit_mb", value);
316 glError = GuestLib_GetMemShares(glHandle, &memShares);
317 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
318 DEBUG ("Failed to get mem shares: %s\n", GuestLib_GetErrorText(glError));
321 value = (gauge_t) memShares;
322 vmware_submit_gauge ("memory_shares", value);
324 glError = GuestLib_GetMemMappedMB(glHandle, &memMappedMB);
325 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
326 DEBUG ("Failed to get mapped mem: %s\n", GuestLib_GetErrorText(glError));
328 value = (gauge_t) memMappedMB;
329 vmware_submit_gauge ("memory_mapped_mb", value);
331 glError = GuestLib_GetMemActiveMB(glHandle, &memActiveMB);
332 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
333 DEBUG ("Failed to get active mem: %s\n", GuestLib_GetErrorText(glError));
335 value = (gauge_t) memActiveMB;
336 vmware_submit_gauge ("memory_active_mb", value);
338 glError = GuestLib_GetMemOverheadMB(glHandle, &memOverheadMB);
339 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
340 DEBUG ("Failed to get overhead mem: %s\n", GuestLib_GetErrorText(glError));
342 value = (gauge_t) memOverheadMB;
343 vmware_submit_gauge ("memory_overhead_mb", value);
345 glError = GuestLib_GetMemBalloonedMB(glHandle, &memBalloonedMB);
346 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
347 DEBUG ("Failed to get ballooned mem: %s\n", GuestLib_GetErrorText(glError));
349 value = (gauge_t) memBalloonedMB;
350 vmware_submit_gauge ("memory_ballooned_mb", value);
352 glError = GuestLib_GetMemSwappedMB(glHandle, &memSwappedMB);
353 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
354 DEBUG ("Failed to get swapped mem: %s\n", GuestLib_GetErrorText(glError));
356 value = (gauge_t) memSwappedMB;
357 vmware_submit_gauge ("memory_swapped_mb", value);
359 glError = GuestLib_GetMemSharedMB(glHandle, &memSharedMB);
360 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
361 DEBUG ("Failed to get swapped mem: %s\n", GuestLib_GetErrorText(glError));
363 value = (gauge_t) memSharedMB;
364 vmware_submit_gauge ("memory_shared_mb", value);
366 glError = GuestLib_GetMemSharedSavedMB(glHandle, &memSharedSavedMB);
367 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
368 DEBUG ("Failed to get swapped mem: %s\n", GuestLib_GetErrorText(glError));
370 value = (gauge_t) memSharedSavedMB;
371 vmware_submit_gauge ("memory_shared_saved_mb", value);
373 glError = GuestLib_GetMemUsedMB(glHandle, &memUsedMB);
374 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
375 DEBUG ("Failed to get swapped mem: %s\n", GuestLib_GetErrorText(glError));
377 value = (gauge_t) memUsedMB;
378 vmware_submit_gauge ("memory_used_mb", value);
380 glError = GuestLib_GetElapsedMs(glHandle, &elapsedMs);
381 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
382 DEBUG ("Failed to get elapsed ms: %s\n", GuestLib_GetErrorText(glError));
384 value = (counter_t) elapsedMs;
385 vmware_submit_counter ("elapsed_ms", value);
387 glError = GuestLib_GetCpuStolenMs(glHandle, &cpuStolenMs);
388 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
389 DEBUG ("Failed to get CPU stolen: %s\n", GuestLib_GetErrorText(glError));
390 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION) {
394 value = (counter_t) cpuStolenMs;
395 vmware_submit_counter ("cpu_stolen_ms", value);
397 glError = GuestLib_GetMemTargetSizeMB(glHandle, &memTargetSizeMB);
398 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
399 DEBUG ("Failed to get target mem size: %s\n", GuestLib_GetErrorText(glError));
400 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION) {
404 value = (gauge_t) memTargetSizeMB;
405 vmware_submit_gauge ("memory_target_size", value);
407 glError = GuestLib_GetHostNumCpuCores(glHandle, &hostNumCpuCores);
408 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
409 DEBUG ("Failed to get host CPU cores: %s\n", GuestLib_GetErrorText(glError));
410 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
411 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
415 value = (gauge_t) hostNumCpuCores;
416 vmware_submit_gauge ("host_cpu_cores", value);
418 glError = GuestLib_GetHostCpuUsedMs(glHandle, &hostCpuUsedMs);
419 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
420 DEBUG ("Failed to get host CPU used: %s\n", GuestLib_GetErrorText(glError));
421 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
422 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
426 value = (counter_t) hostCpuUsedMs;
427 vmware_submit_counter ("host_cpu_used_ms", value);
429 glError = GuestLib_GetHostMemSwappedMB(glHandle, &hostMemSwappedMB);
430 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
431 DEBUG ("Failed to get host mem swapped: %s\n", GuestLib_GetErrorText(glError));
432 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
433 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
434 hostMemSwappedMB = 0;
437 value = (gauge_t) hostMemSwappedMB;
438 vmware_submit_gauge ("host_mem_swapped_mb", value);
440 glError = GuestLib_GetHostMemSharedMB(glHandle, &hostMemSharedMB);
441 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
442 DEBUG ("Failed to get host mem shared: %s\n", GuestLib_GetErrorText(glError));
443 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
444 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
448 value = (gauge_t) hostMemSharedMB;
449 vmware_submit_gauge ("host_mem_shared_mb", value);
451 glError = GuestLib_GetHostMemUsedMB(glHandle, &hostMemUsedMB);
452 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
453 DEBUG ("Failed to get host mem used: %s\n", GuestLib_GetErrorText(glError));
454 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
455 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
459 value = (gauge_t) hostMemSharedMB;
460 vmware_submit_gauge ("host_mem_used_mb", value);
462 glError = GuestLib_GetHostMemPhysMB(glHandle, &hostMemPhysMB);
463 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
464 DEBUG ("Failed to get host phys mem: %s\n", GuestLib_GetErrorText(glError));
465 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
466 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
470 value = (gauge_t) hostMemPhysMB;
471 vmware_submit_gauge ("host_mem_physical_mb", value);
473 glError = GuestLib_GetHostMemPhysFreeMB(glHandle, &hostMemPhysFreeMB);
474 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
475 DEBUG ("Failed to get host phys mem free: %s\n", GuestLib_GetErrorText(glError));
476 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
477 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
478 hostMemPhysFreeMB = 0;
481 value = (gauge_t) hostMemPhysFreeMB;
482 vmware_submit_gauge ("host_mem_physical_free_mb", value);
484 glError = GuestLib_GetHostMemKernOvhdMB(glHandle, &hostMemKernOvhdMB);
485 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
486 DEBUG ("Failed to get host kernel overhead mem: %s\n", GuestLib_GetErrorText(glError));
487 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
488 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
489 hostMemKernOvhdMB = 0;
492 value = (gauge_t) hostMemKernOvhdMB;
493 vmware_submit_gauge ("host_mem_kernel_overhead_mb", value);
495 glError = GuestLib_GetHostMemMappedMB(glHandle, &hostMemMappedMB);
496 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
497 DEBUG ("Failed to get host mem mapped: %s\n", GuestLib_GetErrorText(glError));
498 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
499 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
503 value = (gauge_t) hostMemMappedMB;
504 vmware_submit_gauge ("host_mem_mapped_mb", value);
506 glError = GuestLib_GetHostMemUnmappedMB(glHandle, &hostMemUnmappedMB);
507 if (glError != VMGUESTLIB_ERROR_SUCCESS) {
508 DEBUG ("Failed to get host mem unmapped: %s\n", GuestLib_GetErrorText(glError));
509 if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION ||
510 glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
511 hostMemUnmappedMB = 0;
514 value = (gauge_t) hostMemUnmappedMB;
515 vmware_submit_gauge ("host_mem_unmapped_mb", value);
520 void module_register (void)
522 plugin_register_init ("vmware", vmware_init);
523 plugin_register_read ("vmware", vmware_read);