steampipe plugin install aws

Table: aws_cloudwatch_alarm - Query AWS CloudWatch Alarms using SQL

The AWS CloudWatch Alarms is a feature of Amazon CloudWatch, a monitoring service for AWS resources and applications. CloudWatch Alarms allow you to monitor Amazon Web Services resources and trigger actions when changes in data points meet certain defined thresholds. They help you react quickly to issues that may affect your applications or infrastructure, thereby enhancing your ability to keep applications running smoothly.

Table Usage Guide

The aws_cloudwatch_alarm table in Steampipe provides you with information about alarms within AWS CloudWatch. This table allows you, as a DevOps engineer, to query alarm-specific details, including its current state, configuration, and actions associated with each alarm. You can utilize this table to gather insights on alarms, such as alarms in a particular state, alarms associated with specific AWS resources, and understanding the actions that will be triggered when an alarm state changes. The schema outlines the various attributes of the CloudWatch alarm for you, including the alarm name, alarm description, metric name, comparison operator, and associated tags.

Examples

Basic info

Explore the status and configurations of your CloudWatch alarms to understand their current operational state and the conditions that trigger them. This can help you monitor the health and performance of your AWS resources more effectively.

select
name,
state_value,
metric_name,
actions_enabled,
comparison_operator,
namespace,
statistic
from
aws_cloudwatch_alarm;
select
name,
state_value,
metric_name,
actions_enabled,
comparison_operator,
namespace,
statistic
from
aws_cloudwatch_alarm;

List alarms in alarm state

Discover the segments that are currently in an alarm state. This is useful to quickly identify and address any issues within your cloud infrastructure.

select
name,
arn,
state_value,
state_reason
from
aws_cloudwatch_alarm
where
state_value = 'ALARM';
select
name,
arn,
state_value,
state_reason
from
aws_cloudwatch_alarm
where
state_value = 'ALARM';

List alarms with alarm actions enabled

Identify instances where alarms have been activated with specific actions in the AWS CloudWatch service. This can be useful in understanding the active monitoring and alerting mechanisms in place for system events.

select
arn,
actions_enabled,
alarm_actions
from
aws_cloudwatch_alarm
where
actions_enabled;
select
arn,
actions_enabled,
alarm_actions
from
aws_cloudwatch_alarm
where
actions_enabled = 1;

Get the metric attached to each alarm based on a single metric

Discover the segments that have alarms set based on specific metrics within the AWS Cloudwatch service. This is particularly useful for monitoring and managing application performance, resource utilization, and operational health.

select
name,
metric_name,
namespace,
period,
statistic,
dimensions
from
aws_cloudwatch_alarm
where
metric_name is not null;
select
name,
metric_name,
namespace,
period,
statistic,
dimensions
from
aws_cloudwatch_alarm
where
metric_name is not null;

Get metrics attached to each alarm based on a metric math expression

Identify the metrics associated with each alarm based on mathematical expressions. This can help in understanding the performance of various elements and aid in proactive monitoring and troubleshooting.

select
name,
metric ->> 'Id' as metric_id,
metric ->> 'Expression' as metric_expression,
metric -> 'MetricStat' -> 'Metric' ->> 'MetricName' as metric_name,
metric -> 'MetricStat' -> 'Metric' ->> 'Namespace' as metric_namespace,
metric -> 'MetricStat' -> 'Metric' ->> 'Dimensions' as metric_dimensions,
metric ->> 'ReturnData' as metric_return_data
from
aws_cloudwatch_alarm,
jsonb_array_elements(metrics) as metric;
select
name,
json_extract(metric, '$.Id') as metric_id,
json_extract(metric, '$.Expression') as metric_expression,
json_extract(metric, '$.MetricStat.Metric.MetricName') as metric_name,
json_extract(metric, '$.MetricStat.Metric.Namespace') as metric_namespace,
json_extract(metric, '$.MetricStat.Metric.Dimensions') as metric_dimensions,
json_extract(metric, '$.ReturnData') as metric_return_data
from
aws_cloudwatch_alarm,
json_each(metrics) as metric;

Schema for aws_cloudwatch_alarm

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe AWS Account ID in which the resource is located.
actions_enabledbooleanIndicates whether actions should be executed during any changes to the alarm state.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
alarm_actionsjsonbThe actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
alarm_configuration_updated_timestamptimestamp with time zoneThe time stamp of the last update to the alarm configuration.
alarm_descriptiontextThe description of the alarm.
arntextThe Amazon Resource Name (ARN) of the alarm.
comparison_operatortextThe arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
datapoints_to_alarmbigintThe number of data points that must be breaching to trigger the alarm.
dimensionsjsonbThe dimensions for the metric associated with the alarm.
evaluate_low_sample_count_percentiletextUsed only for alarms based on percentiles.
evaluation_periodsbigintThe number of periods over which data is compared to the specified threshold.
extended_statistictextThe percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
insufficient_data_actionsjsonbThe actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
metric_nametextThe name of the metric associated with the alarm, if this is an alarm based on a single metric.
metricsjsonbAn array of MetricDataQuery structures, used in an alarm based on a metric math expression.
nametext=The name of the alarm.
namespacetextThe namespace of the metric associated with the alarm.
ok_actionsjsonbThe actions to execute when this alarm transitions to the OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
periodbigintThe period, in seconds, over which the statistic is applied.
regiontextThe AWS Region in which the resource is located.
state_reasontextAn explanation for the alarm state, in text format.
state_reason_datatextAn explanation for the alarm state, in JSON format.
state_updated_timestamptimestamp with time zoneThe time stamp of the last update to the alarm state.
state_valuetext=The state value for the alarm.
statistictextThe statistic for the metric associated with the alarm, other than percentile.
tagsjsonbA map of tags for the resource.
tags_srcjsonbThe list of tag keys and values associated with alarm.
thresholddouble precisionThe value to compare with the specified statistic.
threshold_metric_idtextIn an alarm based on an anomaly detection model, this is the ID of the ANOMALY_DETECTION_BAND function used as the threshold for the alarm.
titletextTitle of the resource.
treat_missing_datatextSets how this alarm is to handle missing data points. If this parameter is omitted, the default behavior of missing is used.
unittextThe unit of the metric associated with the alarm.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws

You can pass the configuration to the command with the --config argument:

steampipe_export_aws --config '<your_config>' aws_cloudwatch_alarm