Calling the APIs from Your Application
The following steps provide a possible API sequence of calls:
Procedure
- Include vmGuestAppMonitorLib.h in the declarations for your C program.
- To start the monitoring, notify the virtual machine that you are going to start sending a heartbeat signal by calling VMGuestAppMonitor_Enable.
- After you enable VM guest app monitoring, call VMGuestAppMonitor_MarkActive every 30 seconds to prevent reset of the virtual machine.
- Send VMGuestAppMonitor_IsEnabled to make sure the virtual machine infrastructure received your requests correctly and has begun monitoring.
-
Periodically, call
VMGuestAppMonitor_GetAppStatus to make sure the vSphere
infrastructure is still receiving the heartbeat calls.
The status will be returned as Green, Red, or Gray. See HA Application Monitoring API Calls for a description of each status value. The figure below shows a possible coding flow for the GetAppStatus call.
Figure 1. Coding flow for VMGuestAppMonitor_GetAppStatus
-
After you call
VMGuestAppMonitor_GetAppStatus, call the
VMGuestAppMonitor_Free function to free the memory that
was used to store the status.
If your application does not free the memory, it can use a large amount of memory very quickly because a new status is created every 30 seconds, after every VMGuestAppMonitor_MarkActive call.
- Call VMGuestAppMonitor_Disable when you want the agent to stop monitoring.