AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Each PutMetricData
request is limited to 8 KB in size for HTTP GET requests
and is limited to 40 KB in size for HTTP POST requests.
Value
parameter accepts numbers of type Double
,
Amazon CloudWatch rejects values that are either too small or too large. Values must
be in the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360 (Base
2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are not supported.
Data that is timestamped 24 hours or more in the past may take in excess of 48 hours
to become available from submission time using GetMetricStatistics
.
Namespace: Amazon.CloudWatch
Assembly: AWSSDK.dll
Version: (assembly version)
public abstract PutMetricDataResponse PutMetricData( PutMetricDataRequest request )
Container for the necessary parameters to execute the PutMetricData service method.
Exception | Condition |
---|---|
InternalServiceException | Indicates that the request processing has failed due to some unknown error, exception, or failure. |
InvalidParameterCombinationException | Parameters that must not be used together were used together. |
InvalidParameterValueException | Bad or out-of-range value was supplied for the input parameter. |
MissingRequiredParameterException | An input parameter that is mandatory for processing the request is not supplied. |
This example shows how to publish a set of metric data points.
var client = new AmazonCloudWatchClient(); var dimension = new Dimension { Name = "Desktop Machine Metrics", Value = "Virtual Desktop Machine Usage" }; var metric1 = new MetricDatum { Dimensions = new List<Dimension>(), MetricName = "Desktop Machines Online", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 14 }; var metric2 = new MetricDatum { Dimensions = new List<Dimension>(), MetricName = "Desktop Machines Offline", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 7 }; var metric3 = new MetricDatum { Dimensions = new List<Dimension>(), MetricName = "Desktop Machines Online", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 12 }; var metric4 = new MetricDatum { Dimensions = new List<Dimension>(), MetricName = "Desktop Machines Offline", StatisticValues = new StatisticSet(), Timestamp = DateTime.Today, Unit = StandardUnit.Count, Value = 9 }; var request = new PutMetricDataRequest { MetricData = new List<MetricDatum>() { metric1, metric2, metric3, metric4 }, Namespace = "Example.com Custom Metrics" }; client.PutMetricData(request);
.NET Framework:
Supported in: 4.5, 4.0, 3.5