

# Monitoring Storage Gateway
Monitoring Storage Gateway

This section describes how to monitor a Storage Gateway, including monitoring resources associated with the gateway, using Amazon CloudWatch. You can monitor the gateway's upload buffer and cache storage. You use the Storage Gateway console to view metrics and alarms for your gateway. For example, you can view the number of bytes used in read and write operations, the time spent in read and write operations, and the time taken to retrieve data from the Amazon Web Services Cloud. With metrics, you can track the health of your gateway and set up alarms to notify you when one or more metrics fall outside a defined threshold.

Storage Gateway provides CloudWatch metrics at no additional charge. Storage Gateway metrics are recorded for a period of two weeks. By using these metrics, you can access historical information and get a better perspective on how your gateway and volumes are performing. Storage Gateway also provides CloudWatch alarms, except high-resolution alarms, at no additional charge. For more information about CloudWatch pricing, see [Amazon CloudWatch pricing](https://aws.amazon.com/cloudwatch/pricing/). For more information about CloudWatch, see [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html).

For information specific to monitoring a Volume Gateway and its associated resources, see [Monitoring your Volume Gateway](https://docs.aws.amazon.com/storagegateway/latest/vgw/monitoring-volume-gateway.html).

**Topics**
+ [

# Understanding gateway metrics
](MonitoringGateways-common.md)
+ [

# Monitoring the upload buffer
](PerfUploadBuffer-common.md)
+ [

# Monitoring cache storage
](PerfCache-common.md)
+ [

# Understanding CloudWatch alarms
](cloudwatch-alarms.md)
+ [

# Creating recommended CloudWatch alarms for your gateway
](cloudwatch-alarms-create-recommended.md)
+ [

# Creating a custom CloudWatch alarm for your gateway
](cloudwatch-alarms-create-alarm.md)
+ [

# Monitoring your Volume Gateway
](monitoring-volume-gateway.md)

# Understanding gateway metrics
Understanding gateway metrics

For the discussion in this topic, we define *gateway* metrics as metrics that are scoped to the gateway—that is, they measure something about the gateway. Because a gateway contains one or more volumes, a gateway-specific metric is representative of all volumes on the gateway. For example, the `CloudBytesUploaded` metric is the total number of bytes that the gateway sent to the cloud during the reporting period. This metric includes the activity of all the volumes on the gateway.

When working with gateway metric data, you specify the unique identification of the gateway that you are interested in viewing metrics for. To do this, you specify both the `GatewayId` and the `GatewayName` values. When you want to work with metric for a gateway, you specify the gateway *dimension* in the metrics namespace, which distinguishes a gateway-specific metric from a volume-specific metric. For more information, see [Using Amazon CloudWatch Metrics](UsingCloudWatchConsole-common.md).

**Note**  
Some metrics return data points only when new data has been generated during the most recent monitoring period.


| Metric | Description | 
| --- | --- | 
| AvailabilityNotifications | Number of availability-related health notifications generated by the gateway. Use this metric with the `Sum` statistic to observe whether the gateway is experiencing any availability-related events. For details about the events, check your configured CloudWatch log group. Unit: Number | 
| CacheHitPercent |  Percent of application reads served from the cache. The sample is taken at the end of the reporting period. Unit: Percent  | 
| CachePercentDirty |  The overall percentage of the gateway cache that has not been persisted to AWS. The sample is taken at the end of the reporting period. Use this metric with the `Sum` statistic. Ideally, this metric should remain low. Unit: Percent  | 
| CacheUsed |  The total number of bytes being used in the gateway's cache storage. The sample is taken at the end of the reporting period. Unit: Bytes  | 
| IoWaitPercent |  Percent of time that the gateway is waiting on a response from the local disk. Unit: Percent  | 
| MemTotalBytes |  Amount of RAM provisioned to the gateway VM, in bytes. Unit: Bytes  | 
| MemUsedBytes |  Amount of RAM currently in use by the gateway VM, in bytes. Unit: Bytes  | 
| QueuedWrites |  Normally, this value represents the number of locally-stored bytes waiting to be written to AWS, but it also reflects the synchronization process that occurs between local data and cloud data during "bootstrapping", which occurs each time a gateway restarts. Unit: Bytes  | 
| ReadBytes |  The total number of bytes read from your on-premises applications in the reporting period for all volumes in the gateway. Use this metric with the `Sum` statistic to measure throughput and with the `Samples` statistic to measure IOPS. Unit: Bytes  | 
| ReadTime |  The total number of milliseconds spent to do read operations from your on-premises applications in the reporting period for all volumes in the gateway. Use this metric with the `Average` statistic to measure latency. Unit: Milliseconds  | 
| TimeSinceLastRecoveryPoint |  The time since the last available recovery point. For more information, see [Your Cached Gateway is Unreachable And You Want to Recover Your Data](troubleshoot-volume-issues.md#RecoverySnapshotTroubleshooting). Unit: Seconds  | 
| TotalCacheSize |  The total size of the cache in bytes. The sample is taken at the end of the reporting period. Unit: Bytes  | 
| UploadBufferPercentUsed |  Percent use of the gateway's upload buffer. The sample is taken at the end of the reporting period. Unit: Percent  | 
| UploadBufferUsed |  The total number of bytes being used in the gateway's upload buffer. The sample is taken at the end of the reporting period. Unit: Bytes  | 
| UserCpuPercent |  Percent of CPU time spent on gateway processing, averaged across all cores. Unit: Percent  | 
| WorkingStorageFree |  The total amount of unused space in the gateway's working storage. The sample is taken at the end of the reporting period. Unit: Bytes  | 
| WorkingStoragePercentUsed |  Percent use of the gateway's upload buffer. The sample is taken at the end of the reporting period. Unit: Percent  | 
| WorkingStorageUsed |  The total number of bytes being used in the gateway's upload buffer. The sample is taken at the end of the reporting period. Unit: Bytes  | 
| WriteBytes |  The total number of bytes written to your on-premises applications in the reporting period for all volumes in the gateway. Use this metric with the `Sum` statistic to measure throughput and with the `Samples` statistic to measure IOPS. Unit: Bytes  | 
| WriteTime |  The total number of milliseconds spent to do write operations from your on-premises applications in the reporting period for all volumes in the gateway. Use this metric with the `Average` statistic to measure latency. Unit: Milliseconds  | 

## Dimensions for Storage Gateway metrics
Dimensions for Storage Gateway metrics

The CloudWatch namespace for the Storage Gateway service is `AWS/StorageGateway`. Data is available automatically in 5-minute periods at no charge.


| Dimension | Description | 
| --- | --- | 
|  GatewayId, GatewayName |  These dimensions filter the data that you request to gateway-specific metrics. You can identify a gateway to work by the value for `GatewayId` or `GatewayName`. If the name of your gateway was different for the time range that you are interested in viewing metrics, use the `GatewayId`. Throughput and latency data of a gateway is based on all the volumes for the gateway. For information about working with gateway metrics, see [Measuring Performance Between Your Gateway and AWS](https://docs.aws.amazon.com/storagegateway/latest/vgw/monitoring-volume-gateway.html#PerfGatewayAWS-common).   | 
|  VolumeId  |  This dimension filters the data you request to volume-specific metrics. Identify a storage volume to work with by its `VolumeId` value. For information about working with volume metrics, see [Measuring Performance Between Your Application and Gateway](https://docs.aws.amazon.com/storagegateway/latest/vgw/monitoring-volume-gateway.html#PerfAppGateway-common).  | 

# Monitoring the upload buffer


You can find information following about how to monitor a gateway's upload buffer and how to create an alarm so that you get a notification when the buffer exceeds a specified threshold. By using this approach, you can add buffer storage to a gateway before it fills completely and your storage application stops backing up to AWS.

You monitor the upload buffer in the same way in both the cached-volume and Tape Gateway architectures. For more information, see [How Volume Gateway works](StorageGatewayConcepts.md).

**Note**  
The `WorkingStoragePercentUsed`, `WorkingStorageUsed`, and `WorkingStorageFree` metrics represent the upload buffer for stored volumes only before the release of the cached-volume feature in Storage Gateway. Now, use the equivalent upload buffer metrics `UploadBufferPercentUsed`, `UploadBufferUsed`, and `UploadBufferFree`. These metrics apply to both gateway architectures.


| Item of Interest | How to Measure | 
| --- | --- | 
| Upload buffer usage |  Use the `UploadBufferPercentUsed`, `UploadBufferUsed`, and `UploadBufferFree` metrics with the `Average` statistic. For example, use the `UploadBufferUsed` with the `Average` statistic to analyze the storage usage over a time period.  | <a name="PerfUploadBufferMeasuring-common"></a>

**To measure the percent of the upload buffer that is used**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose the **StorageGateway: Gateway Metrics** dimension, and find the gateway that you want to work with.

1. Choose the `UploadBufferPercentUsed` metric.

1. For **Time Range**, choose a value.

1. Choose the `Average` statistic.

1. For **Period**, choose a value of 5 minutes to match the default reporting time.

The resulting time-ordered set of data points contains the percent used of the upload buffer.

Using the following procedure, you can create an alarm using the CloudWatch console. To learn more about alarms and thresholds, see [Creating CloudWatch Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html) in the *Amazon CloudWatch User Guide*.<a name="GatewayAlarm1-common"></a>

**To set an upper threshold alarm for a gateway's upload buffer**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Create Alarm** to start the Create Alarm wizard.

1. Specify a metric for your alarm:

   1. On the **Select Metric** page of the Create Alarm wizard, choose the **AWS/StorageGateway:GatewayId,GatewayName** dimension, and then find the gateway that you want to work with.

   1. Choose the `UploadBufferPercentUsed` metric. Use the `Average` statistic and a period of 5 minutes.

   1. Choose **Continue**.

1. Define the alarm name, description, and threshold:

   1. On the **Define Alarm** page of the Create Alarm wizard, identify your alarm by giving it a name and description in the **Name** and **Description** boxes.

   1. Define the alarm threshold.

   1. Choose **Continue**.

1. Configure an email action for the alarm:

   1. On the **Configure Actions** page of the Create Alarm wizard, choose **Alarm** for **Alarm State**.

   1. Choose **Choose or create email topic** for **Topic**.

      To create an email topic means that you set up an Amazon SNS topic. For more information about Amazon SNS, see [Set Up Amazon SNS](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_SetupSNS.html) in the *Amazon CloudWatch User Guide.*

   1. For **Topic**, enter a descriptive name for the topic.

   1. Choose **Add Action**.

      

   1. Choose **Continue**.

1. Review the alarm settings, and then create the alarm:

   1. On the **Review** page of the Create Alarm wizard, review the alarm definition, metric, and associated actions to take (for example, sending an email notification).

   1. After reviewing the alarm summary, choose **Save Alarm**.

1. Confirm your subscription to the alarm topic:

   1. Open the Amazon SNS email that was sent to the email address that you specified when creating the topic.

   1. Confirm your subscription by clicking the link in the email.

      A subscription confirmation appears.

# Monitoring cache storage


You can find information following about how to monitor a gateway's cache storage and how to create an alarm so that you get a notification when parameters of the cache pass specified thresholds. Using this alarm, you know when to add cache storage to a gateway.

You only monitor cache storage in the cached volumes architecture. For more information, see [How Volume Gateway works](StorageGatewayConcepts.md).


| Item of Interest | How to Measure | 
| --- | --- | 
| Total usage of cache |  Use the `CachePercentUsed` and `TotalCacheSize` metrics with the `Average` statistic. For example, use the `CachePercentUsed` with the `Average` statistic to analyze the cache usage over a period of time. The `TotalCacheSize` metric changes only when you add cache to the gateway.  | 
| Percent of read requests that are served from the cache |  Use the `CacheHitPercent` metric with the `Average` statistic. Typically, you want `CacheHitPercent` to remain high.  | 
| Percent of the cache that is dirty—that is, it contains content that has not been uploaded to AWS |  Use the `CachePercentDirty` metrics with the `Average` statistic. Typically, you want `CachePercentDirty` to remain low.  | <a name="PerfCacheDirtyMeasuring-common1"></a>

**To measure the percent of a cache that is dirty for a gateway and all its volumes**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose the **StorageGateway: Gateway Metrics** dimension, and find the gateway that you want to work with.

1. Choose the `CachePercentDirty` metric.

1. For **Time Range**, choose a value.

1. Choose the `Average` statistic.

1. For **Period**, choose a value of 5 minutes to match the default reporting time.

The resulting time-ordered set of data points contains the percentage of the cache that is dirty over the 5 minutes.<a name="PerfCacheDirtyMeasuring-common"></a>

**To measure the percent of the cache that is dirty for a volume**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose the **StorageGateway: Volume Metrics** dimension, and find the volume that you want to work with.

1. Choose the `CachePercentDirty` metric.

1. For **Time Range**, choose a value.

1. Choose the `Average` statistic.

1. For **Period**, choose a value of 5 minutes to match the default reporting time.

The resulting time-ordered set of data points contains the percentage of the cache that is dirty over the 5 minutes.

# Understanding CloudWatch alarms
Understanding CloudWatch alarms

CloudWatch alarms monitor information about your gateway based on metrics and expressions. You can add CloudWatch alarms for your gateway and view their statuses in the Storage Gateway console. For more information about the metrics that are used to monitor Volume Gateway, see [Understanding gateway metrics](https://docs.aws.amazon.com/storagegateway/latest/vgw/Main_monitoring-gateways-common.html#MonitoringGateways-common) and [Understanding Volume Metrics](https://docs.aws.amazon.com/storagegateway/latest/vgw/monitoring-volume-gateway.html#MonitoringVolumes-common). For each alarm, you specify conditions that will initiate its ALARM state. Alarm status indicators in the Storage Gateway console turn red when in the ALARM state, making it easier for you to monitor status proactively. You can configure alarms to invoke actions automatically based on sustained changes in state. For more information about CloudWatch alarms, see [Using Amazon CloudWatch alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html) in the *Amazon CloudWatch User Guide*.

**Note**  
If you don't have permission to view CloudWatch, you can't view the alarms.

For each activated gateway, we recommend that you create the following CloudWatch alarms:
+ High IO wait: `IoWaitpercent` >= 20 for 3 datapoints in 15 minutes
+ Cache percent dirty: `CachePercentDirty` > 80 for 4 datapoints within 20 minutes
+ Health notifications: `HealthNotifications` >= 1 for 1 datapoint within 5 minutes. When configuring this alarm, set **Missing data treatment** to **notBreaching**.
**Note**  
You can set a health notification alarm only if the gateway had a previous health notification in CloudWatch.

For gateways on VMware host platforms with HA mode activated, we also recommend this additional CloudWatch alarm:
+ Availability notifications: `AvailabilityNotifications` >= 1 for 1 datapoint within 5 minutes. When configuring this alarm, set **Missing data treatment** to **notBreaching**.

The following table describes the state of an alarm. 


| State | Description | 
| --- | --- | 
|  **OK**  |  The metric or expression is within the defined threshold.  | 
|  **Alarm**  |  The metric or expression is outside of the defined threshold.  | 
|  **Insufficient data**  |  The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.  | 
|  **None**  |  No alarms are created for the gateway. To create a new alarm, see [Creating a custom CloudWatch alarm for your gateway](cloudwatch-alarms-create-alarm.md).  | 
|  **Unavailable**  |  The state of the alarm is unknown. Choose **Unavailable** to view error information in the **Monitoring** tab.  | 

# Creating recommended CloudWatch alarms for your gateway
Creating recommended CloudWatch alarms

When you create a new gateway using the Storage Gateway console, you can choose to create all recommended CloudWatch alarms automatically as part of the initial setup process. For more information, see [Configure your Volume Gateway](https://docs.aws.amazon.com/storagegateway/latest/vgw/create-volume-gateway.html#configure-gateway-volume). If you want to add or update recommended CloudWatch alarms for an existing gateway, use the following procedure.

**To add or update recommended CloudWatch alarms for an existing gateway**
**Note**  
This feature requires CloudWatch policy permissions, which are *not* automatically granted as part of the preconfigured Storage Gateway full access policy. Make sure your security policy grants the following permissions before you attempt to create recommended CloudWatch alarms:  
`cloudwatch:PutMetricAlarm` - create alarms
`cloudwatch:DisableAlarmActions` - turn alarm actions off
`cloudwatch:EnableAlarmActions` - turn alarm actions on
`cloudwatch:DeleteAlarms` - delete alarms

1. Open the Storage Gateway console at [https://console.aws.amazon.com/storagegateway/home/](https://console.aws.amazon.com/storagegateway/home/).

1. In the navigation pane, choose **Gateways**, then choose the gateway for which you want to create recommended CloudWatch alarms.

1. On the gateway details page, choose the **Monitoring** tab.

1. Under **Alarms**, choose **Create recommended alarms**. The recommended alarms are created automatically.

   The **Alarms** section lists all CloudWatch alarms for a specific gateway. From here, you can select and delete one or more alarms, turn alarm actions on or off, and create new alarms.

# Creating a custom CloudWatch alarm for your gateway
Creating a custom CloudWatch alarm

CloudWatch uses Amazon Simple Notification Service (Amazon SNS) to send alarm notifications when an alarm changes state. An alarm watches a single metric over a time period that you specify, and performs one or more actions based on the value of the metric relative to a given threshold over a number of time periods. The action is a notification that's sent to an Amazon SNS topic. You can create an Amazon SNS topic when you create a CloudWatch alarm. For more information about Amazon SNS, see [What is Amazon SNS?](https://docs.aws.amazon.com/sns/latest/dg/welcome.html) in the *Amazon Simple Notification Service Developer Guide*.

**To create a CloudWatch alarm in the Storage Gateway console**

1. Open the Storage Gateway console at [https://console.aws.amazon.com/storagegateway/home/](https://console.aws.amazon.com/storagegateway/home/).

1. In the navigation pane, choose **Gateways**, then choose the gateway for which you want to create an alarm.

1. On the gateway details page, choose the **Monitoring** tab.

1. Under **Alarms**, choose **Create alarm** to open the CloudWatch console.

1. Use the CloudWatch console to create the type of alarm that you want. You can create the following types of alarms:
   + Static threshold alarm: An alarm based on a set threshold for a chosen metric. The alarm enters the ALARM state when the metric breaches the threshold for a specified number of evaluation periods.

     To create a static threshold alarm, see [Creating a CloudWatch alarm based on a static threshold](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ConsoleAlarms.html) in the *Amazon CloudWatch User Guide*.
   + Anomaly detection alarm: Anomaly detection mines past metric data and creates a model of expected values. You set a value for the anomaly detection threshold, and CloudWatch uses this threshold with the model to determine the "normal" range of values for the metric. A higher value for the threshold produces a thicker band of "normal" values. You can choose to activate the alarm only when the metric value is above the band of expected values, only when it's below the band, or when it's above or below the band.

     To create an anomaly detection alarm, see [Creating a CloudWatch alarm based on anomaly detection](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create_Anomaly_Detection_Alarm.html) in the *Amazon CloudWatch User Guide*.
   + Metric math expression alarm: An alarm based one or more metrics used in a math expression. You specify the expression, threshold, and evaluation periods.

     To create a metric math expression alarm, see [Creating a CloudWatch alarm based on a metric math expression](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create-alarm-on-metric-math-expression.html) in the *Amazon CloudWatch User Guide*.
   + Composite alarm: An alarm that determines its alarm state by watching the alarm states of other alarms. A composite alarm can help you reduce alarm noise.

     To create a composite alarm, see [Creating a composite alarm](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create_Composite_Alarm.html) in the *Amazon CloudWatch User Guide*.

1. After you create the alarm in the CloudWatch console, return to the Storage Gateway console. You can view the alarm by doing one of the following:
   + In the navigation pane, choose **Gateways**, then choose the gateway for which you want to view alarms. On the **Details** tab, under **Alarms**, choose **CloudWatch Alarms**.
   + In the navigation pane, choose **Gateways**, choose the gateway for which you want to view alarms, then choose the **Monitoring** tab.

     The **Alarms** section lists all of the CloudWatch alarms for a specific gateway. From here, you can select and delete one or more alarms, turn alarm actions on or off, and create new alarms.
   + In the navigation pane, choose **Gateways**, then choose the alarm state of the gateway for which you want to view alarms.

For information about how to edit or delete an alarm, see [Editing or deleting a CloudWatch alarm](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Edit-CloudWatch-Alarm.html).

**Note**  
When you delete a gateway using the Storage Gateway console, all CloudWatch alarms associated with the gateway are also automatically deleted.

# Monitoring your Volume Gateway


The topics in this section describe how to monitor Volume Gateway in either cached volume or stored volume setup, including monitoring the volumes associated with the gateway and monitoring the upload buffer. You use the AWS Management Console to view metrics for your gateway. For example, you can view the number of bytes used in read and write operations, the time spent in read and write operations, and the time taken to retrieve data from the Amazon Web Services cloud. With metrics, you can track the health of your gateway and set up alarms to notify you when one or more metrics fall outside a defined threshold. 

Storage Gateway provides CloudWatch metrics at no additional charge. Storage Gateway metrics are recorded for a period of two weeks. By using these metrics, you can access historical information and get a better perspective on how your gateway and volumes are performing. For detailed information about CloudWatch, see the [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/).

**Topics**
+ [Getting Volume Gateway health logs with Amazon CloudWatch Logs](cw-log-groups-volume.md) - Learn how to use Amazon CloudWatch Logs to get information about the health of your Volume Gateway and related resources.
+ [Using Amazon CloudWatch Metrics](UsingCloudWatchConsole-common.md) - Learn how to get monitoring data for your gateway using either the AWS Management Console or the CloudWatch API.
+ [Measuring Performance Between Your Application and Gateway](PerfAppGateway-common.md) - Learn how to measure data throughput, data latency, and operations per second to understand performance between your applications and your gateway.
+ [Measuring Performance Between Your Gateway and AWS](PerfGatewayAWS-common.md) - Learn how to measure data throughput, data latency, and operations per second to understand performance between your gateway and the AWS cloud.
+ [Understanding volume metrics](MonitoringVolumes-common.md) - Learn how to measure metrics that provide data about the volumes associated with a gateway.

# Getting Volume Gateway health logs with Amazon CloudWatch Logs
Getting Volume Gateway health logs

You can use Amazon CloudWatch Logs to get information about the health of your Volume Gateway and related resources. You can use these logs to monitor your gateway for errors that it encounters. In addition, you can use Amazon CloudWatch subscription filters to automate processing of the log information in real time. For more information, see [Real-time Processing of Log Data with Subscriptions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Subscriptions.html) in the *Amazon CloudWatch User Guide.*

For example, suppose that your gateway is deployed in a cluster activated with VMware High Availability (HA) and you need to know about any errors. You can configure a CloudWatch log group to monitor your gateway and get notified when your gateway encounters an error. You can either configure the group when you are activating the gateway or after your gateway is activated and up and running. For information about how to configure a CloudWatch log group when activating a gateway, see [Configure your Volume Gateway](create-volume-gateway.md#configure-gateway-volume). For general information about CloudWatch log groups, see [Working with Log Groups and Log Streams](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html) in the *Amazon CloudWatch User Guide.*

For information about how to troubleshoot and fix these types of errors, see [Troubleshooting volume issues](troubleshoot-volume-issues.md).

The following procedure shows you how to configure a CloudWatch log group after your gateway is activated. 

**To configure a CloudWatch log group to work with your gateway**

1. Sign in to the AWS Management Console and open the Storage Gateway console at [https://console.aws.amazon.com/storagegateway/home](https://console.aws.amazon.com/storagegateway/).

1. In the left navigation pane, choose **Gateways**, and then choose the gateway that you want to configure the CloudWatch log group for.

1. For **Actions**, choose **Edit gateway information**, or on the **Details** tab, under **Health logs** and **Not Enabled**, choose **Configure log group** to open the **Edit *CustomerGatewayName*** dialog box.

1. For **Gateway health log group**, choose one of the following:
   + **Disable logging** if you don't want to monitor your gateway using CloudWatch log groups.
   + **Create a new log group** to create a new CloudWatch log group.
   + **Use an existing log group** to use a CloudWatch log group that already exists. Choose a log group from the **Existing log group list**.

1. Choose **Save changes**.

1. To see the health logs for your gateway, do the following:

   1. In the left navigation pane, choose **Gateways**, and then choose the gateway that you configured the CloudWatch log group for.

   1. Choose the **Details** tab, and under **Health logs**, choose **CloudWatch Logs**. The **Log group details** page opens in the Amazon CloudWatch console.

# Using Amazon CloudWatch Metrics


You can get monitoring data for your gateway using either the AWS Management Console or the CloudWatch API. The console displays a series of graphs based on the raw data from the CloudWatch API. You can also use the CloudWatch API through one of the [AWS Software Development Kits (SDKs)](https://aws.amazon.com/tools) or the [Amazon CloudWatch API](https://aws.amazon.com/cloudwatch) tools. Depending on your needs, you might prefer to use either the graphs displayed in the console or retrieved from the API. 

Regardless of which method you choose to use to work with metrics, you must specify the following information: 
+ The metric dimension to work with. A *dimension* is a name-value pair that helps you to uniquely identify a metric. The dimensions for Storage Gateway are `GatewayId`, `GatewayName`, and `VolumeId`. In the CloudWatch console, you can use the `Gateway Metrics` and `Volume Metrics` views to easily select gateway-specific and volume-specific dimensions. For more information about dimensions, see [Dimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension) in the *Amazon CloudWatch User Guide*.
+ The metric name, such as `ReadBytes`.

The following table summarizes the types of Storage Gateway metric data that you can use. 

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/storagegateway/latest/vgw/UsingCloudWatchConsole-common.html)

Working with gateway and volume metrics is similar to working with other service metrics. You can find a discussion of some of the most common metrics tasks in the CloudWatch documentation listed following: 
+ [Viewing Available Metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/viewing_metrics_with_cloudwatch.html)
+ [Getting Statistics for a Metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_GetStatistics.html)
+ [Creating CloudWatch Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html)

# Measuring Performance Between Your Application and Gateway


Data throughput, data latency, and operations per second are three measures that you can use to understand how your application storage that is using your gateway is performing. When you use the correct aggregation statistic, you can use Storage Gateway metrics to measure these values. 

A *statistic* is an aggregation of a metric over a specified period of time. When you view the values of a metric in CloudWatch, use the `Average` statistic for data latency (milliseconds), use the `Sum` statistic for data throughput (bytes per second), and use the `Samples` statistic for input/output operations per second (IOPS). For more information, see [Statistics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Statistic) in the *Amazon CloudWatch User Guide*.

The following table summarizes the metrics and corresponding statistic you can use to measure the throughput, latency, and IOPS between your applications and gateways. 


| Item of Interest | How to Measure | 
| --- | --- | 
| Throughput  |  Use the `ReadBytes` and `WriteBytes` metrics with the `Sum` CloudWatch statistic. For example, the `Sum` value of the `ReadBytes` metric over a sample period of 5 minutes divided by 300 seconds gives you the throughput as a rate in bytes per second.  | 
| Latency | Use the ReadTime and WriteTime metrics with the Average CloudWatch statistic. For example, the Average value of the ReadTime metric gives you the latency per operation over the sample period of time. | 
| IOPS | Use the ReadBytes and WriteBytes metrics with the Samples CloudWatch statistic. For example, the Samples value of the ReadBytes metric over a sample period of 5 minutes divided by 300 seconds gives you IOPS. | 

For the average latency graphs and average size graphs, the average is calculated over the total number of operations (read or write, whichever is applicable to the graph) that completed during the period. 

**To measure the data throughput from an application to a volume**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Metrics**, then choose the **All metrics** tab and then choose **Storage Gateway**.

1. Choose the **Volume metrics** dimension, and find the volume that you want to work with.

1. Choose the `ReadBytes` and `WriteBytes` metrics.

1. For **Time Range**, choose a value.

1. Choose the `Sum` statistic.

1. For **Period**, choose a value of 5 minutes or greater.

1. In the resulting time-ordered sets of data points (one for `ReadBytes` and one for `WriteBytes`), divide each data point by the period (in seconds) to get the throughput at the sample point. The total throughput is the sum of the throughputs.

For example, if the read throughput is 2,384,199,680 bytes over a period of 300 seconds, then the approximate throughput rate for that datapoint is 7.9 megabytes per second.

**To measure the data input/output operations per second from an application to a volume**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Metrics**, then choose the **All metrics** tab and then choose **Storage Gateway**.

1. Choose the **Volume metrics** dimension, and find the volume that you want to work with.

1. Choose the `ReadBytes` and `WriteBytes` metrics.

1. For **Time Range**, choose a value.

1. Choose the `Samples` statistic.

1. For **Period**, choose a value of 5 minutes or greater.

1. In the resulting time-ordered sets of data points (one for `ReadBytes` and one for `WriteBytes`), divide each data point by the period (in seconds) to get IOPS.

For example, if the number of write operations is 24,373 over a period of 300 seconds, then the IOPS for that data point is 81 write operations per second.

# Measuring Performance Between Your Gateway and AWS


Data throughput, data latency, and operations per second are three measures that you can use to understand how your application storage using the Storage Gateway is performing. These three values can be measured using the Storage Gateway metrics provided for you when you use the correct aggregation statistic. The following table summarizes the metrics and corresponding statistic to use to measure the throughput, latency, and input/output operations per second (IOPS) between your gateway and AWS. 


| Item of Interest | How to Measure | 
| --- | --- | 
| Throughput  |  Use the `ReadBytes` and `WriteBytes` metrics with the `Sum` CloudWatch statistic. For example, the `Sum` value of the `ReadBytes` metric over a sample period of 5 minutes divided by 300 seconds gives you the throughput as a rate in bytes per second.   | 
| Latency | Use the ReadTime and WriteTime metrics with the Average CloudWatch statistic. For example, the Average value of the ReadTime metric gives you the latency per operation over the sample period of time.  | 
| IOPS | Use the ReadBytes and WriteBytes metrics with the Samples CloudWatch statistic. For example, the Samples value of the ReadBytes metric over a sample period of 5 minutes divided by 300 seconds gives you IOPS.  | 
| Throughput to AWS | Use the CloudBytesDownloaded and CloudBytesUploaded metrics with the Sum CloudWatch statistic. For example, the Sum value of the CloudBytesDownloaded metric over a sample period of 5 minutes divided by 300 seconds gives you the throughput from AWS to the gateway as bytes per second. | 
| Latency of data to AWS | Use the CloudDownloadLatency metric with the Average statistic. For example, the Average statistic of the CloudDownloadLatency metric gives you the latency per operation. | 

**To measure the upload data throughput from a gateway to AWS**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Metrics**, then choose the **All metrics** tab and then choose **Storage Gateway**.

1. Choose the **Gateway metrics** dimension, and find the volume that you want to work with.

1. Choose the `CloudBytesUploaded` metric.

1. For **Time Range**, choose a value.

1. Choose the `Sum` statistic.

1. For **Period**, choose a value of 5 minutes or greater.

1. In the resulting time-ordered set of data points, divide each data point by the period (in seconds) to get the throughput at that sample period.

Moving the cursor over a data point displays information about the data point, including its value and bytes uploaded. Divide this value by the **Period** value (5 minutes) to get the throughput at that sample point. For example, if the throughput from the gateway to AWS is 555,544,576 bytes over a period of 300 seconds, then the approximate throughput per second is 1.85 megabytes per second.

 

![\[a sample cloud bytes uploaded metric graph for a gateway with the sum statistic.\]](http://docs.aws.amazon.com/storagegateway/latest/vgw/images/GatewayMetrics_25.png)


**To measure the latency per operation of a gateway**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Metrics**, then choose the **All metrics** tab and then choose **Storage Gateway**.

1. Choose the **Gateway metrics** dimension, and find the volume that you want to work with.

1. Choose the `ReadTime` and `WriteTime` metrics.

1. For **Time Range**, choose a value.

1. Choose the `Average` statistic.

1. For **Period**, choose a value of 5 minutes to match the default reporting time. 

1.  In the resulting time-ordered set of points (one for `ReadTime` and one for `WriteTime`), add data points at the same time sample to get to the total latency in milliseconds.

**To measure the data latency from a gateway to AWS**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Metrics**, then choose the **All metrics** tab and then choose **Storage Gateway**.

1. Choose the **Gateway metrics** dimension, and find the volume that you want to work with.

1. Choose the `CloudDownloadLatency` metric.

1. For **Time Range**, choose a value.

1. Choose the `Average` statistic.

1. For **Period**, choose a value of 5 minutes to match the default reporting time. 

The resulting time-ordered set of data points contains the latency in milliseconds.<a name="GatewayAlarm2-common"></a>

**To set an upper threshold alarm for a gateway's throughput to AWS**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Alarms**.

1. Choose **Create Alarm** to start the Create Alarm wizard.

1. Choose the **Storage Gateway** dimension, and find the gateway that you want to work with.

1. Choose the `CloudBytesUploaded` metric.

1. To define the alarm, define the alarm state when the `CloudBytesUploaded` metric is greater than or equal to a specified value for a specified time. For example, you can define an alarm state when the `CloudBytesUploaded` metric is greater than 10 MB for 60 minutes.

1. Configure the actions to take for the alarm state. For example, you can have an email notification sent to you.

1. Choose **Create Alarm**.<a name="GatewayAlarm3-common"></a>

**To set an upper threshold alarm for reading data from AWS**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Create Alarm** to start the Create Alarm wizard.

1. Choose the **StorageGateway: Gateway Metrics** dimension, and find the gateway that you want to work with.

1. Choose the `CloudDownloadLatency` metric.

1. Define the alarm by defining the alarm state when the `CloudDownloadLatency` metric is greater than or equal to a specified value for a specified time. For example, you can define an alarm state when the `CloudDownloadLatency` is greater than 60,000 milliseconds for greater than 2 hours.

1. Configure the actions to take for the alarm state. For example, you can have an email notification sent to you.

1. Choose **Create Alarm**.

# Understanding volume metrics


You can find information following about the Storage Gateway metrics that cover a volume of a gateway. Each volume of a gateway has a set of metrics associated with it. 

Some volume-specific metrics have the same name as certain gateway-specific metrics. These metrics represent the same kinds of measurements but are scoped to the volume instead of the gateway. Before starting work, specify whether you want to work with a gateway metric or a volume metric. Specifically, when working with volume metrics, specify the volume ID for the storage volume that you want to view metrics for. For more information, see [Using Amazon CloudWatch Metrics](UsingCloudWatchConsole-common.md).

**Note**  
Some metrics return data points only when new data has been generated during the most recent monitoring period.

The following table describes the Storage Gateway metrics that you can use to get information about your storage volumes. 


| Metric | Description | Cached Volumes | Stored Volumes | 
| --- | --- | --- | --- | 
| AvailabilityNotification |  The number of availibility notifications sent by the volume. Units: count  | Yes | Yes | 
| CacheHitPercent |  Percent of application read operations from the volume that are served from cache. The sample is taken at the end of the reporting period. When there are no application read operations from the volume, this metric reports 100 percent.  Units: Percent  | Yes | No | 
| CachePercentDirty |  The volume's contribution to the overall percentage of the gateway's cache that isn't persisted to AWS. The sample is taken at the end of the reporting period. Use the `CachePercentDirty` metric of the gateway to view the overall percentage of the gateway's cache that isn't persisted to AWS. For more information, see [Understanding gateway metrics](MonitoringGateways-common.md). Units: Percent  | Yes | Yes | 
| CachePercentUsed |  The volume's contribution to the overall percent use of the gateway's cache storage. The sample is taken at the end of the reporting period. Use the `CachePercentUsed` metric of the gateway to view overall percent use of the gateway's cache storage. For more information, see [Understanding gateway metrics](MonitoringGateways-common.md). Units: Percent  | Yes | No | 
| CloudBytesDownloaded |  The number of bytes downloaded from the cloud to the volume. Units: Bytes  | Yes | Yes | 
| CloudBytesUploaded |  The number of bytes uploaded from the cloud to the volume. Units: Bytes  | Yes | Yes | 
| HealthNotification |  The number of health notifications sent by the volume. Units: count  | Yes | Yes | 
| IoWaitPercent |  The percentage of IoWaitPercent units that are currently used by the volume.  Units: Percent  | Yes | Yes | 
| MemTotalBytes |  The percentage of total memory that is currently used by the volume.  Units: Percent  | Yes | No | 
| MemoryUsage |  The percentage of memory that is currently used by the volume.  Units: Percent  | Yes | No | 
| ReadBytes  |  The total number of bytes read from your on-premises applications in the reporting period. Use this metric with the `Sum` statistic to measure throughput and with the `Samples`statistic to measure IOPS. Units: Bytes  | Yes | Yes | 
| ReadTime |  The total number of milliseconds spent on read operations from your on-premises applications in the reporting period. Use this metric with the `Average` statistic to measure latency. Units: Milliseconds  | Yes | Yes | 
| UserCpuPercent |  The percentage of allocated CPU compute units that are currently used by the volume.  Units: Percent  | Yes | Yes | 
| WriteBytes |  The total number of bytes written to your on-premises applications in the reporting period. Use this metric with the `Sum` statistic to measure throughput and with the `Samples` statistic to measure IOPS. Units: Bytes  | Yes | Yes | 
| WriteTime |  The total number of milliseconds spent on write operations from your on-premises applications in the reporting period.  Use this metric with the `Average` statistic to measure latency. Units: Milliseconds  | Yes | Yes | 
| QueuedWrites |  The number of bytes waiting to be written to AWS, sampled at the end of the reporting period.  Units: Bytes  | Yes | Yes | 