Calling the APIs from Your
Application
The following steps provide a possible API
sequence of calls:
- IncludevmGuestAppMonitorLib.hin 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 ha-application-monitoring-api-functions.html#GUID-1FEC22B0-06B4-4F7B-A736-975ED20EBBD2-en_ID-3875-000006A9.
- After you have called VMGuestAppMonitor_Enable, call ha-application-monitoring-api-functions.html#GUID-1FEC22B0-06B4-4F7B-A736-975ED20EBBD2-en_ID-3875-000006C2 every 30 seconds or your virtual machine will be reset.
- Send VMGuestAppMonitor_IsEnabled to make sure the virtual machine infrastructure received your requests correctly and has begun monitoring.
- Periodically, call ha-application-monitoring-api-functions.html#GUID-1FEC22B0-06B4-4F7B-A736-975ED20EBBD2-en_ID-3875-000006D8 to make sure the vSphere infrastructure is still receiving the heartbeat calls.The status will be returned asGreen,Red, orGray. See Table 1 for a description of each status value. The figure below shows a possible coding flow for the GetAppStatus call.Coding flow for VMGuestAppMonitor_GetAppStatus
- After you call VMGuestAppMonitor_GetAppStatus, call the ha-application-monitoring-api-functions.html#GUID-1FEC22B0-06B4-4F7B-A736-975ED20EBBD2-en_ID-3875-000006EA 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 storage very quickly because a new status is created every 30 seconds, when VMGuestAppMonitor_MarkActive is called.
- Call ha-application-monitoring-api-functions.html#GUID-1FEC22B0-06B4-4F7B-A736-975ED20EBBD2-en_ID-3875-000006B2 when you want the agent to stop monitoring.