CloudWatch class

Amazon CloudWatch monitors your Amazon Web Services (AWS) resources and the applications you run on AWS in real time. You can use CloudWatch to collect and track metrics, which are the variables you want to measure for your resources and applications.

CloudWatch alarms send notifications or automatically change the resources you are monitoring based on rules that you define. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2 instances. Then, use this data to determine whether you should launch additional instances to handle increased load. You can also use this data to stop under-used instances to save money.

In addition to monitoring the built-in metrics that come with AWS, you can monitor your own custom metrics. With CloudWatch, you gain system-wide visibility into resource utilization, application performance, and operational health.


CloudWatch({@_s.required String region, AwsClientCredentials credentials, Client client})


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


deleteAlarms({List<String> alarmNames}) Future<void>
Deletes the specified alarms. You can delete up to 100 alarms in one operation. However, this total can include no more than one composite alarm. For example, you could delete 99 metric alarms and one composite alarms with one operation, but you can't delete two composite alarms with one operation. [...]
deleteAnomalyDetector({String metricName, String namespace, String stat, List<Dimension> dimensions}) Future<void>
Deletes the specified anomaly detection model from your account. [...]
deleteDashboards({List<String> dashboardNames}) Future<void>
Deletes all dashboards that you specify. You may specify up to 100 dashboards to delete. If there is an error during this call, no dashboards are deleted. [...]
deleteInsightRules({List<String> ruleNames}) Future<DeleteInsightRulesOutput>
Permanently deletes the specified Contributor Insights rules. [...]
describeAlarmHistory({String alarmName, List<String> alarmTypes, DateTime endDate, HistoryItemType historyItemType, int maxRecords, String nextToken, ScanBy scanBy, DateTime startDate}) Future<DescribeAlarmHistoryOutput>
Retrieves the history for the specified alarm. You can filter the results by date range or item type. If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned. [...]
describeAlarms({String actionPrefix, String alarmNamePrefix, List<String> alarmNames, List<String> alarmTypes, String childrenOfAlarmName, int maxRecords, String nextToken, String parentsOfAlarmName, StateValue stateValue}) Future<DescribeAlarmsOutput>
Retrieves the specified alarms. You can filter the results by specifying a a prefix for the alarm name, the alarm state, or a prefix for any action. [...]
describeAlarmsForMetric({String metricName, String namespace, List<Dimension> dimensions, String extendedStatistic, int period, Statistic statistic, StandardUnit unit}) Future<DescribeAlarmsForMetricOutput>
Retrieves the alarms for the specified metric. To filter the results, specify a statistic, period, or unit. [...]
describeAnomalyDetectors({List<Dimension> dimensions, int maxResults, String metricName, String namespace, String nextToken}) Future<DescribeAnomalyDetectorsOutput>
Lists the anomaly detection models that you have created in your account. You can list all models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. [...]
describeInsightRules({int maxResults, String nextToken}) Future<DescribeInsightRulesOutput>
Returns a list of all the Contributor Insights rules in your account. All rules in your account are returned with a single operation. [...]
disableAlarmActions({List<String> alarmNames}) Future<void>
Disables the actions for the specified alarms. When an alarm's actions are disabled, the alarm actions do not execute when the alarm state changes. [...]
disableInsightRules({List<String> ruleNames}) Future<DisableInsightRulesOutput>
Disables the specified Contributor Insights rules. When rules are disabled, they do not analyze log groups and do not incur costs. [...]
enableAlarmActions({List<String> alarmNames}) Future<void>
Enables the actions for the specified alarms. [...]
enableInsightRules({List<String> ruleNames}) Future<EnableInsightRulesOutput>
Enables the specified Contributor Insights rules. When rules are enabled, they immediately begin analyzing log data. [...]
getDashboard({String dashboardName}) Future<GetDashboardOutput>
Displays the details of the dashboard that you specify. [...]
getInsightRuleReport({DateTime endTime, int period, String ruleName, DateTime startTime, int maxContributorCount, List<String> metrics, String orderBy}) Future<GetInsightRuleReportOutput>
This operation returns the time series data collected by a Contributor Insights rule. The data includes the identity and number of contributors to the log group. [...]
getMetricData({DateTime endTime, List<MetricDataQuery> metricDataQueries, DateTime startTime, int maxDatapoints, String nextToken, ScanBy scanBy}) Future<GetMetricDataOutput>
You can use the GetMetricData API to retrieve as many as 500 different metrics in a single request, with a total of as many as 100,800 data points. You can also optionally perform math expressions on the values of the returned statistics, to create new time series that represent new insights into your data. For example, using Lambda metrics, you could divide the Errors metric by the Invocations metric to get an error rate time series. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide. [...]
getMetricStatistics({DateTime endTime, String metricName, String namespace, int period, DateTime startTime, List<Dimension> dimensions, List<String> extendedStatistics, List<String> statistics, StandardUnit unit}) Future<GetMetricStatisticsOutput>
Gets statistics for the specified metric. [...]
getMetricWidgetImage({String metricWidget, String outputFormat}) Future<GetMetricWidgetImageOutput>
You can use the GetMetricWidgetImage API to retrieve a snapshot graph of one or more Amazon CloudWatch metrics as a bitmap image. You can then embed this image into your services and products, such as wiki pages, reports, and documents. You could also retrieve images regularly, such as every minute, and create your own custom live dashboard. [...]
listDashboards({String dashboardNamePrefix, String nextToken}) Future<ListDashboardsOutput>
Returns a list of the dashboards for your account. If you include DashboardNamePrefix, only those dashboards with names starting with the prefix are listed. Otherwise, all dashboards in your account are listed. [...]
listMetrics({List<DimensionFilter> dimensions, String metricName, String namespace, String nextToken}) Future<ListMetricsOutput>
List the specified metrics. You can use the returned metrics with GetMetricData or GetMetricStatistics to obtain statistical data. [...]
listTagsForResource({String resourceARN}) Future<ListTagsForResourceOutput>
Displays the tags associated with a CloudWatch resource. Currently, alarms and Contributor Insights rules support tagging. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
putAnomalyDetector({String metricName, String namespace, String stat, AnomalyDetectorConfiguration configuration, List<Dimension> dimensions}) Future<void>
Creates an anomaly detection model for a CloudWatch metric. You can use the model to display a band of expected normal values when the metric is graphed. [...]
putCompositeAlarm({String alarmName, String alarmRule, bool actionsEnabled, List<String> alarmActions, String alarmDescription, List<String> insufficientDataActions, List<String> oKActions, List<Tag> tags}) Future<void>
Creates or updates a composite alarm. When you create a composite alarm, you specify a rule expression for the alarm that takes into account the alarm states of other alarms that you have created. The composite alarm goes into ALARM state only if all conditions of the rule are met. [...]
putDashboard({String dashboardBody, String dashboardName}) Future<PutDashboardOutput>
Creates a dashboard if it does not already exist, or updates an existing dashboard. If you update a dashboard, the entire contents are replaced with what you specify here. [...]
putInsightRule({String ruleDefinition, String ruleName, String ruleState, List<Tag> tags}) Future<void>
Creates a Contributor Insights rule. Rules evaluate log events in a CloudWatch Logs log group, enabling you to find contributor data for the log events in that log group. For more information, see Using Contributor Insights to Analyze High-Cardinality Data. [...]
putMetricAlarm({String alarmName, ComparisonOperator comparisonOperator, int evaluationPeriods, bool actionsEnabled, List<String> alarmActions, String alarmDescription, int datapointsToAlarm, List<Dimension> dimensions, String evaluateLowSampleCountPercentile, String extendedStatistic, List<String> insufficientDataActions, String metricName, List<MetricDataQuery> metrics, String namespace, List<String> oKActions, int period, Statistic statistic, List<Tag> tags, double threshold, String thresholdMetricId, String treatMissingData, StandardUnit unit}) Future<void>
Creates or updates an alarm and associates it with the specified metric, metric math expression, or anomaly detection model. [...]
putMetricData({List<MetricDatum> metricData, String namespace}) Future<void>
Publishes metric data points to Amazon CloudWatch. CloudWatch associates the data points with the specified metric. If the specified metric does not exist, CloudWatch creates the metric. When CloudWatch creates a metric, it can take up to fifteen minutes for the metric to appear in calls to ListMetrics. [...]
setAlarmState({String alarmName, String stateReason, StateValue stateValue, String stateReasonData}) Future<void>
Temporarily sets the state of an alarm for testing purposes. When the updated state differs from the previous value, the action configured for the appropriate state is invoked. For example, if your alarm is configured to send an Amazon SNS message when an alarm is triggered, temporarily changing the alarm state to ALARM sends an SNS message. [...]
tagResource({String resourceARN, List<Tag> tags}) Future<void>
Assigns one or more tags (key-value pairs) to the specified CloudWatch resource. Currently, the only CloudWatch resources that can be tagged are alarms and Contributor Insights rules. [...]
toString() String
Returns a string representation of this object.
untagResource({String resourceARN, List<String> tagKeys}) Future<void>
Removes one or more tags from the specified resource. [...]


operator ==(dynamic other) bool
The equality operator. [...]