4.32 VmMemoryUsage

Use this Knowledge Script to monitor memory usage for a virtual machine. This script raises an event if a monitored metric exceeds the threshold you set. This script monitors and collects data for the following performance metrics:

  • Memory active - Amount of guest physical memory in use by the virtual machine. This is an estimate provided by the VMkernel and represents the actual amount of memory the virtual machine needs.

  • Memory balloon - Amount of guest physical memory that is currently reclaimed from the virtual machine through ballooning. This is the amount of guest physical memory that has been allocated and pinned by the balloon driver.

  • Memory consumed - Amount of guest physical memory consumed by the virtual machine for guest memory. Consumed memory does not include overhead memory. It includes shared memory and memory that might be reserved, but not actually used.

  • Memory granted - Guest “physical” memory that is mapped to machine memory.

  • Memory overhead - Amount of overhead memory (in kilobytes) required for virtualization of the virtual machine. Excess memory overhead values can indicate virtualization problems.

  • Memory shared - Amount of guest “physical” memory shared with other virtual machines (through the VMkernel’s transparent page-sharing mechanism, a RAM de-duplication technique).

  • Memory state - Amount of free machine memory on the host. The VMkernel has four free-memory thresholds that affect memory reclamation:

    • 0 (high) Free memory ≥ 6% of machine memory minus Service Console memory.

    • 1 (soft) 4%

    • 2 (hard) 2%

    • 3 (low) 1%

    • 0 (high) and 1 (soft): Swapping is favored over ballooning.

    • 2 (hard) and 3 (low): Ballooning is favored over swapping.

  • Memory swap in - Total amount of data that has been read into machine memory from the swap file since the virtual machine was powered on.

  • Memory swap in rate - Rate at which memory is swapped from disk into active memory.

  • Memory swap out - Total amount of data that the VMkernel has written to the virtual machine's swap file from machine memory. This statistic refers to VMkernel swapping and not to guest OS swapping.

  • Memory swap out rate - Rate at which memory is being swapped from active memory to disk.

  • Memory usage - Percentage of total configured or available memory usage.

  • Memory zero - Memory (as a percentage) that is zeroed out. This value can indicate that there are virtual machines with more memory allocated to them than they need. By reducing the allocated memory you can increase the total number of running virtual machines, achieving a greater virtual to physical running ratio.

NOTE:

  • If the parent host of the monitored virtual machine is in maintenance mode, this Knowledge Script will not generate events.

  • Using this script and other VirtualCenter_Vm* scripts to monitor a large number of virtual machines at the same time might cause the jobs to fail. If the jobs fail on a regular basis, consider running the VirtualCenter_Vm* scripts on fewer virtual machines.

4.32.1 Resource Object

vSphere virtual machine

4.32.2 Default Schedule

By default, this script runs every day at 15 minute intervals starting at 12:03 AM and ending at 11:59 PM. If you start the job after the scheduled starting time, the script runs at the time of the next scheduled interval. For example, if you start the job at 12:10 AM, it runs for the first time at 12:18 AM.

NOTE:If you are running this script as part of the Recommended Knowledge Script Groups, do not change the schedule. The schedules for the recommended scripts are staggered to lessen the impact on CPU utilization when you run the KSG.

4.32.3 Setting Parameter Values

Set the following parameters as needed:

Parameter

How to Set It

General Settings

Job Failure Notification

Raise event when memory metrics are not available?

Select Yes to raise an event if memory metrics are not available. The default is unselected.

Event severity when memory metrics are not available

Set the event severity level, from 1 to 40, to indicate the importance of an event in which memory metrics are not available. The default is 15.

Event severity when AppManager failed to get metrics

Set the event severity level, from 1 to 40, to indicate the importance of an event in which AppManager failed to retrieve metrics from vCenter. The default is 15.

Event severity when AppManager failed to log in

Set the event severity level, from 1 to 40, to indicate the importance of an event in which AppManager failed to log in to vCenter. The default is 5.

Event severity when VmMemoryUsage job fails unexpectedly

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the VmMemoryUsage job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format

Select either HTML Table or Plain Text as the format for event detail. The default is HTML Table.

Monitoring Memory Active

Event Notification

Raise event when memory active exceeds the threshold?

Select Yes to raise an event when the memory active exceeds the threshold you set. The default is unselected.

Threshold -- Maximum for memory active

Specify the maximum percentage for memory active before an event is raised. The default is 20 percent.

Event severity when memory active exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event when the active memory exceeds the threshold. The default is 15.

Data Collection

Collect data for memory active?

Select Yes to collect data about memory active for charts and reports. The default is unselected.

Monitor Memory Balloon

Event Notification

Raise event when memory balloon exceeds the threshold?

Select Yes to raise an event if the percentage of memory balloon exceeds the threshold you set. The default is Yes.

Threshold -- Maximum memory balloon

Specify the maximum percentage for memory balloon before an event is raised. The default is 2 percent.

Event severity when memory balloon exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the percentage of memory balloon exceeds the threshold. The default is 15.

Data Collection

Collect data for memory balloon?

Select Yes to collect data about memory balloon for charts and reports. The default is unselected.

Monitor Memory Consumed

Event Notification

Raise event when memory consumed exceeds the threshold?

Select Yes to raise an event if the percentage of memory consumed exceeds the threshold you set. The default is Yes.

Threshold -- Maximum memory consumed

Specify the maximum percentage of memory consumed before an event is raised. The default is 80 percent.

Event severity when memory consumed exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the percentage of memory consumed exceeds the threshold. The default is 15.

Data Collection

Collect data for memory consumed?

Select Yes to collect data about memory consumed for charts and reports. The default is unselected.

Monitor Memory Granted

Event Notification

Raise event when memory granted exceeds the threshold?

Select Yes to raise an event when the amount of memory granted exceeds the threshold you set. The default is unselected.

Threshold -- Maximum memory granted

Specify the maximum amount of memory granted before an event is raised. The default is 1024 megabytes.

Event severity when memory granted exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the amount of memory granted exceeds the threshold. The default is 15.

Data Collection

Collect data for memory granted?

Select Yes to collect data about memory granted for charts and reports. The default is unselected.

Monitor Memory Overhead

Event Notification

Raise event when memory overhead exceeds the threshold?

Select Yes to raise an event when the amount of memory overhead exceeds the threshold you set. The default is unselected.

Threshold --Maximum memory overhead

Specify the maximum amount of memory overhead that can occur before an event is raised. The default is 100 megabytes.

Event severity when memory overhead exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the amount of memory shared exceeds the threshold. The default is 15.

Data Collection

Collect data for memory overhead?

Select Yes to collect data about memory overhead for charts and reports. The default is unselected.

Monitor Memory Shared

Event Notification

Raise event when memory shared falls below the threshold?

Select Yes to raise an event when the amount of memory shared falls below the threshold you set. The default is unselected.

Threshold --Maximum memory shared

Specify the maximum amount of memory shared that can occur before an event is raised. The default is 50 megabytes.

Event severity when memory shared exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the amount of memory shared exceeds the threshold. The default is 15.

Data Collection

Collect data for memory shared?

Select Yes to collect data about memory shared for charts and reports. The default is unselected.

Monitor Memory State

Event Notification

Raise event when memory state is hard?

Select Yes to raise an event when the memory state is hard. The default is unselected.

Event severity when memory state is hard

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the memory state is hard. The default is 10.

Raise event when memory state is high?

Select Yes to raise an event when the memory state is high. The default is unselected.

Event severity when memory state is high

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the memory state is high. The default is 25.

Raise event when memory state is low?

Select Yes to raise an event when the memory state is low. The default is unselected.

Event severity when memory state is low

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the memory state is low. The default is 5.

Raise event when memory state is soft?

Select Yes to raise an event when memory state is soft. The default is unselected.

Event severity when memory state is soft

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the memory state is soft. The default is 15.

Data Collection

Collect data for memory state?

Select Yes to collect data about memory state for charts and reports. The default is unselected.

Monitor Memory Swap In

Data Collection

Collect data for memory swap in?

Select Yes to collect data about memory swap in for charts and reports. The default is unselected.

Monitor Memory Swap In Rate

Event Notification

Raise event when memory swap in rate exceeds the threshold?

Select Yes to raise an event when the memory swap in rate exceeds the threshold you set. The default is Yes.

Threshold -- Maximum memory swap in rate

Specify the maximum memory swap in rate that can occur before an event is raised. The default is 1 megabyte per second.

Event severity when memory swap in rate exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the memory swap in rate exceeds the threshold. The default is 15.

Data Collection

Collect data for memory swap in rate?

Select Yes to collect data about memory swap in rate for charts and reports. The default is unselected.

Monitor Memory Swap Out

Data Collection

Collect data for memory swap out?

Select Yes to collect data about memory swap out for charts and reports. The default is unselected.

Monitor Memory Swap Out Rate

Event Notification

Raise event when memory swap out rate exceeds the threshold?

Select Yes to raise an event when the memory swap out rate exceeds the threshold you set. The default is Yes.

Threshold -- Maximum memory swap out rate

Specify the maximum memory swap out rate that can occur before an event is raised. The default is 1 megabyte per second.

Event severity when memory swap out rate exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the memory swap out rate exceeds the threshold. The default is 15.

Data Collection

Collect data for memory swap out rate?

Select Yes to collect data about memory swap out rate for charts and reports. The default is unselected.

Monitor Memory Usage

Event Notification

Raise event when memory usage exceeds the threshold?

Select Yes to raise an event when memory usage exceeds the threshold you set. The default is Yes.

Threshold -- Maximum memory usage

Specify the maximum memory usage that can occur before an event is raised. The default is 80 percent.

Event severity when memory usage exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which memory usage exceeds the threshold. The default is 15.

Data Collection

Collect data for memory usage?

Select Yes to collect data about memory usage for charts and reports. The default is unselected.

Monitor Memory Zero

Event Notification

Raise event when memory zero exceeds the threshold?

Select Yes to raise an event when memory zero exceeds the threshold you set. The default is unselected.

Threshold -- Maximum memory zero

Specify the maximum memory zero that can occur before an event is raised. The default is 20 percent.

Event severity when memory zero exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which memory zero exceeds the threshold. The default is 15.

Data Collection

Collect data for memory zero?

Select Yes to collect data about memory zero for charts and reports. The default is unselected.