Amazon CloudWatch
Amazon CloudWatch is a monitoring and observability service and a repository that aggregates data from more than 70 AWS data sources. CloudWatch also allows users to publish custom metrics from their services. Creating SLOs using this data is a powerful tool to monitor large portfolios of products.
Nobl9 integration with CloudWatch supports CloudWatch Metrics Insights. Leveraging Metrics Insights, Nobl9 users can retrieve metrics even faster and gain added flexibility in querying raw service level indicator (SLI) data to use for their SLOs.
Using CloudWatch as a Source in Nobl9, users can configure their SLOs by leveraging data in CloudWatch-specific groupings – i.e., by region, namespaces, and dimensions.
Scope of Support
The following CloudWatch metric features are not supported:
High-resolution metrics (for details, see Put Metric Data | Amazon CloudWatch Documentation)
Metrics that use more than one Unit.
Authentication
Applications that are integrated with AWS must sign their API requests with AWS Access Keys that are used to sign programmatic requests that users make to AWS. Access keys consist of:
AWS Access Key ID
AWS Secret Access Key
Both AWS Access Key ID
and AWS Secret Access Key
are created as a pair. Your Access Key ID and Secret Access Key are encrypted before being stored on the Nobl9 server.
You can create your AWS Access Key ID and AWS Secret Access Key by using the AWS Management Console. For more details, go to Getting Started with the AWS SDK for Go.
You also need Cloudwatch GetMetricData API permissions to make programmatic requests to AWS API.
If you're using AWS Free Tier, you won't be able to use the GetMetricData API to collect CloudWatch metrics and you won't be able to use Cloudwatch as a data source.
Adding Amazon CloudWatch as a Data Source in the UI
To add CloudWatch as a data source in Nobl9 using the Agent or Direct connection method, follow these steps:
- Navigate to Integrations > Sources.
- Click the
button.
- Click the relevant Source icon.
- Choose a relevant connection method (Agent or Direct), then configure the source as described below.
CloudWatch Direct
Direct Configuration in the UI
Direct connection to CloudWatch requires users to enter their credentials which Nobl9 stores safely. To set up this type of connection:
- Add Access Key ID and Secret Access Key.
For details, see the Authentication section above.
- Select a Project.
Specifying a Project is helpful when multiple users are spread across multiple teams or projects. When the Project field is left blank then object is assigned to projectdefault
. - Enter a Display Name.
You can enter a friendly name with spaces in this field. - Enter a Name.
The name is mandatory and can only contain lowercase, alphanumeric characters and dashes (for example,my-project-name
). This field is populated automatically when you enter a display name, but you can edit the result. - Enter a Description.
Here you can add details such as who is responsible for the integration (team/owner) and the purpose of creating it. - Enter a Maximum Period for Historical Data Retrieval.
- This value defines how far back in the past your data will be retrieved.
- The value for the Maximum period of data retrieval depends on the Source. Check the Replay documentation for details.
- Entering a more extended Period might slow down the loading time when creating an SLO.
- The value must be a positive integer.
- Enter a Default Period for Historical Data Retrieval.
- It is the Period that will be used by the SLO connected to this data source.
- The value must be a positive integer or
0
. - By default, this value is set to 0. If you set it to
>0
, you will create an SLO with Replay.
- Click the Add Data Source
The value for the Maximum Period for Data Retrieval for CloudWatch Configurations queries is 15 days.
Replay for CloudWatch does not support SQL and JSON queries.
If you set value for the Default Value Historical Data Retrieval to >0, you won’t be able to use JSON and SQL queries.
Direct using CLI - YAML
The YAML for setting up a Direct connection to CloudWatch looks like this:
apiVersion: n9/v1alpha
kind: Direct
metadata:
name: cloudwatch-direct
displayName: CloudWatch direct
project: cloudwatch-direct
spec:
description: Direct integration with CloudWatch
sourceOf:
- Metrics
cloudWatch:
accessKeyID: "" #secret
secretAccessKey: "" #secret
historicalDataRetrieval:
maxDuration:
value: 15 # integer greater than or equal to 0
unit: Day # accepted values: Minute, Hour, Day
defaultDuration: # value must be less than or equal to value of maxDuration
value: 0 # integer greater than or equal to 0, default 0
unit: Day # accepted values: Minute, Hour, Day
Important Notes:
spec[n].historicalDataRetrieval
- refer to Replay | Nobl9 Documentation for more details.defaultDuration.value
- If you set value for the Default Value Historical Data Retrieval to>0
, you won’t be able to use JSON and SQL queries. Refer to documentation for more details.
CloudWatch Agent
Agent Configuration in the UI
Follow the instructions below to create your CloudWatch agent connection. Refer to the section above for the description of the fields.
- Enter a Project.
- Enter a Name.
- Create a Description.
- In the Advanced Settings you can:
- Enter a Maximum Period for Historical Data Retrieval.
- Enter a Default Period for Historical Data Retrieval.
- Click the Add Data Source
See notes above for the Maximum Period for Data Retrieval for CloudWatch.
Agent Using CLI - YAML
The YAML for setting up an Agent connection to CloudWatch looks like this:
apiVersion: n9/v1alpha
kind: Agent
metadata:
name: cloudwatch
displayName: AWS CloudWatch # optional
project: cloudwatch
spec:
description: Integration with CloudWatch # optional
sourceOf:
- Metrics
cloudWatch: {}
historicalDataRetrieval:
maxDuration:
value: 15 # integer greater than or equal to 0
unit: Day # accepted values: Minute, Hour, Day
defaultDuration: # value must be less than or equal to value of maxDuration
value: 0 # integer greater than or equal to 0, default 0
unit: Day # accepted values: Minute, Hour, Day
Notes:
spec[n].historicalDataRetrieval
- refer to Replay | Nobl9 Documentation for more details.defaultDuration.value
- If you set value for the Default Value Historical Data Retrieval to>0
, you won’t be able to use JSON and SQL queries. Refer to documentation for more details.
You can deploy only one Agent in one YAML file by using the sloctl apply
command.
Deploying CloudWatch Agent
When you add the data source, Nobl9 automatically generates a Kubernetes configuration and a Docker command line for you to use to deploy the Agent. Both of these are available in the web UI, under the Agent Configuration section. Be sure to swap in your credentials (e.g., if you are using AWS Access Key ID and Secret Access Key, replace AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
in the following deployment descriptions).
Ensure AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
variables are set appropriately if you are using Access/Secret Keys. If these variables are not set, a Default Credential Provider Chain will be used.
- Kubernetes
- Docker
If you use Kubernetes, you can apply the supplied YAML config file to a Kubernetes cluster to deploy the Agent. It will look something like this:
# DISCLAIMER: This deployment description contains only the fields necessary for the purpose of this demo.
# It is not a ready-to-apply k8s deployment description, and the client_id and client_secret are only exemplary values.
apiVersion: v1
kind: Secret
metadata:
name: nobl9-agent-nobl9-dev-cloudwatch-cloudwatch
namespace: default
type: Opaque
stringData:
aws_access_key_id: <AWS_ACCESS_KEY_ID>
aws_secret__access_key: <AWS_SECRET_ACCESS_KEY>
client_id: "unique_user_id"
client_secret: "unique_client_secret"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nobl9-agent-nobl9-dev-cloudwatch-cloudwatch
namespace: default
spec:
replicas: 1
selector:
matchLabels:
nobl9-agent-name: cloudwatch
nobl9-agent-project: cloudwatch
nobl9-agent-organization: nobl9-dev
template:
metadata:
labels:
nobl9-agent-name: cloudwatch
nobl9-agent-project: cloudwatch
nobl9-agent-organization: nobl9-dev
spec:
containers:
- name: agent-container
image: nobl9/agent:latest
resources:
requests:
memory: "350Mi"
cpu: "0.1"
env:
- name: N9_CLIENT_ID
valueFrom:
secretKeyRef:
key: client_id
name: nobl9-agent-nobl9-dev-cloudwatch-cloudwatch
- name: N9_CLIENT_SECRET
valueFrom:
secretKeyRef:
key: client_secret
name: nobl9-agent-nobl9-dev-cloudwatch-cloudwatch
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: aws_access_key_id
name: nobl9-agent-nobl9-dev-cloudwatch-cloudwatch
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: aws_secret_access_key
name: nobl9-agent-nobl9-dev-cloudwatch-cloudwatch
# The N9_METRICS_PORT is a variable specifying the port to which the /metrics and /health endpoints are exposed.
# The 9090 is the default value and can be changed.
# If you don’t want the metrics to be exposed, comment out or delete the N9_METRICS_PORT variable.
- name: N9_METRICS_PORT
value: "9090"
If you use Docker, you can run the Docker command to deploy the Agent. It will look something like this:
# DISCLAIMER: This docker command description is containing only the necessary fields for the purpose of this demo.
# It is not a ready-to-apply docker command.
docker run -d --restart on-failure \
--name nobl9-agent-nobl9-dev-cloudwatch-cloudwatch \
-e N9_CLIENT_ID="unique_client_id" \
-e N9_CLIENT_SECRET="unique_client_secret" \
# The N9_METRICS_PORT is a variable specifying the port to which the /metrics and /health endpoints are exposed.
# The 9090 is the default value and can be changed.
# If you don’t want the metrics to be exposed, comment out or delete the N9_METRICS_PORT variable.
-e N9_METRICS_PORT=9090 \
-e AWS_ACCESS_KEY_ID="<AWS_ACCESS_KEY_ID>" \
-e AWS_SECRET_ACCESS_KEY="<AWS_SECRET_ACCESS_KEY>" \
nobl9/agent:latest
Creating SLOs with CloudWatch
Using Amazon CloudWatch, users can create their SLOs by:
Entering standard Threshold and Ratio metrics.
Entering an SQL query.
Entering multiple queries through JSON.
All three methods are available both in the UI and through applying YAML (see the Creating CloudWatch SLOs - YAML section).
Creating SLOs in the UI
Follow the instructions below to create your SLOs with CloudWatch in the UI:
Navigate to Service Level Objectives.
- Click the
button.
In step 1 of the SLO wizard, select the Service the SLO will be associated with.
In step 2, select Amazon CloudWatch as the Data Source for your SLO, then specify the Metric. You can choose either:
A Threshold Metric where a single time series is evaluated against a threshold.
A Ratio Metric that allows you to enter two-time series to compare. You can choose one of the following metric type:
- Good Metric, meaning a count of
good
requests andtotal
requests. - Bad Metric where
good
requests for evaluation are calculated as a result oftotal - bad
calculation.
- Good Metric, meaning a count of
noteFor the Ratio Metric, you can choose the Data Count Method:
- For the Non-incremental method, we expect it to be the components of the sum.
- For the Incremental method, we expect the value of a metric to be the current sum of some numerator.
For more information, refer to the SLO Calculations Guide.
Enter a Query.
Cloudwatch allows you to create your query by:- Entering standard Threshold and Ratio metrics (Configurations feature).
- Entering an SQL query.
- Entering a multiple query through JSON.
For detailed instructions, refer to the section below.
In step 3, define a Time Window for the SLO.
In step 4, specify the Error Budget Calculation Method and your Objective(s).
In step 5, add a Name, Description, and other details about your SLO. You can also select Alert Policies and Labels on this screen.
When you’re done, click Create SLO.
Entering CloudWatch Query
Both, Ratio and Threshold metrics for a standard CloudWatch metric use the same parameters. For the Ratio Metric, choose one of the following metric type:
- Good Metric, meaning a count of
good
requests and total requests - Bad Metric where
good
requests for evaluation are calculated as a result oftotal - bad
calculation
and define the parameters separately.
- Standard Configuration
- SQL Query
- JSON
- Add a Region. It is a region code in AWS. Use one of the regional codes that are listed here.
- Add a Namespace (mandatory, max. number of characters 255). A namespace can contain alphanumeric characters, period, a hyphen, underscore, forward slash, hash, or colon. A Namespace is a container for CloudWatch metrics. For further details, see CloudWatch Concepts | Amazon CloudWatch Documentation.
- Add a Metric Name (mandatory, max. number of characters 255).
- Add Statistic function. Statistic functions are aggregations of metric data over specified periods. For example, you can use
- Add Dimensions (optional, list). A dimension is a name/value pair that is part of the identity of a metric. Users can assign a max. of 10 dimensions to a metric.
- Add a Name (mandatory, max. number of characters 255, don't trim whitespaces). The name of the dimension. Dimension names must contain only ASCII characters and must include at least one non-whitespace character.
- Add a Value required (max. number of characters 255). It is the value of the dimension. Dimension values must contain only ASCII characters and must include at least one non-whitespace character.
Maximum
, Minimum
, Sum
, Average
. To see all statistics are supported by CloudWatch for metrics, go to Statistics Definition | Amazon CloudWatch Documentation.- Select SQL in the feature toggle.
- Select a Region.
- Select a type of Metric, and enter a Query. Sample SQL queries for CloudWatch:
- SQL Threshold metric for Cloudwatch: Query:
SELECT AVG(CPUUtilization) FROM "AWS/EC2”
- SQL Ratio metric for CloudWatch:
- Good Query:
SELECT AVG(CPUUtilization) FROM "AWS/EC2"
- Total Query:
SELECT MAX(CPUUtilization) FROM "AWS/EC2"
CloudWatch integration enables you to query multiple CloudWatch metrics and use math expressions to create new time series based on these metrics. You can do this by entering Multiple JSON Queries:
- Choose JSON in the feature toggle.
- Choose a Region.
- Select a type of Metric, and enter a Query.
- Enter your JSON query.
- For samples of Multiple JSON Queries refer to the Amazon CloudWatch JSON Queries section in the Nobl9 Documentation.
- For further details on CloudWatch metric math functions, go to Using Metric Math | Amazon CloudWatch Documentation.
SLO using CloudWatch - YAML samples
SLO using CloudWatch - Standard Configuration
- rawMetric
- countMetric
Here’s an example of CloudWatch using a rawMetric
(Threshold Metric):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-occurrences-threshold
project: cloudwatch
spec:
budgetingMethod: Occurrences
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.8
op: lte
rawMetric:
query:
cloudwatch:
region: eu-central-1
namespace: AWS/RDS
metricName: ReadLatency
stat: Average
dimensions:
- name: DBInstanceIdentifier
value: <identifier_of_your_db_instance> # replace with value that corresponds to your DBInstanceIdentifier
value: 0.0004
timeWindows:
- calendar:
startTime: "2020-11-14 12:30:00"
timeZone: Etc/UTC
count: 1
isRolling: false
unit: Day
---
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-timeslices-threshold
project: cloudwatch
spec:
budgetingMethod: Timeslices
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.8
op: lte
rawMetric:
query:
cloudwatch:
region: eu-central-1
namespace: AWS/RDS
metricName: ReadLatency
stat: Average
dimensions:
- name: DBInstanceIdentifier
value: <identifier_of_your_db_instance> # replace with value that corresponds to your DBInstanceIdentifier
value: 0.0004
timeSliceTarget: 0.5
timeWindows:
- calendar:
startTime: "2020-11-14 12:30:00"
timeZone: Etc/UTC
count: 1
isRolling: false
unit: Day
Here’s an example of CloudWatch using a countMetric
(Ratio metric):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-calendar-occurrences-ratio
project: cloudwatch
spec:
budgetingMethod: Occurrences
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.9
countMetrics:
good:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: HTTPCode_Target_2XX_Count
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/prod-default-appingress
incremental: false
total:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: RequestCount
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/prod-default-appingress
displayName: ""
value: 1
timeWindows:
- calendar:
startTime: "2020-11-14 12:30:00"
timeZone: Etc/UTC
count: 1
isRolling: false
unit: Day
---
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-rolling-occurrences-ratio
project: cloudwatch
spec:
budgetingMethod: Occurrences
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.7
countMetrics:
good:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: HTTPCode_Target_2XX_Count
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/prod-default-appingress
incremental: false
total:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: RequestCount
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/prod-default-appingress
displayName: ""
value: 1
timeWindows:
- count: 1
isRolling: true
unit: Hour
---
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-calendar-timeslices-ratio
project: cloudwatch
spec:
budgetingMethod: Timeslices
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.5
countMetrics:
good:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: HTTPCode_Target_2XX_Count
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/main-default-appingress
incremental: false
total:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: RequestCount
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/main-default-appingress
displayName: ""
timeSliceTarget: 0.5
value: 1
timeWindows:
- calendar:
startTime: "2020-11-14 12:30:00"
timeZone: Etc/UTC
count: 1
isRolling: false
unit: Day
---
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-rolling-timeslices-ratio
project: cloudwatch
spec:
budgetingMethod: Timeslices
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.5
countMetrics:
good:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: HTTPCode_Target_2XX_Count
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/main-default-appingress
incremental: false
total:
cloudwatch:
region: eu-central-1
namespace: AWS/ApplicationELB
metricName: RequestCount
stat: SampleCount
dimensions:
- name: LoadBalancer
value: app/main-default-appingress
timeSliceTarget: 0.5
value: 1
timeWindows:
- count: 1
isRolling: true
unit: Hour
Important Notes:
Both, Ratio and Threshold metrics for CloudWatch use the same parameters.
For Ratio metric, define these parameters separately for the Good/Bad Metric and Total Metric.
region
is required. It is a region code in AWS. Use one of the regional codes listed here.namespace
is required (string, max. number of characters 255). It can contain alphanumeric characters, period.
, hyphen-
, underscore_
, forward slash/
, hash#
, or colon:
. Anamespace
is a container for CloudWatch metrics. For further details, see CloudWatch Concepts | Amazon CloudWatch Documentation. Example:AWS/ApplicationELB
.metricName
is required (string, max. number of characters 255).stat
is required. stats are aggregations of metric data over specified periods of time. To see what statistics are supported by CloudWatch for metrics, go to Statistics Definitions | Amazon CloudWatch Documentation. Examples:SampleCount, Average, p95, TC(0.005:0.030)
.dimensions
field is optional (list). A dimension is a name/value pair that is part of the identity of a metric. Users can assign a max. of 10 dimensions to a metric.name
is required (string, max. number of characters 255). Dimension names must contain only ASCII characters and must include at least one non-whitespace character.value
is required (string, max. number of characters 255). Dimension values must contain only ASCII characters and must include at least one non-whitespace character.
SLO using CloudWatch SQL query
- rawMetric
- countMetric
Here’s an example of CloudWatch SQL query using rawMetric
(Threshold metric**):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-occurrences-threshold-via-sql
project: cloudwatch
spec:
budgetingMethod: Occurrences
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.8
op: lte
rawMetric:
query:
cloudwatch:
region: us-east-1
sql: 'SELECT AVG(CPUUtilization)FROM "AWS/EC2"'
value: 0.0004
timeWindows:
- calendar:
startTime: "2021-10-01 12:30:00"
timeZone: Etc/UTC
count: 1
isRolling: false
unit: Day
Here’s an example of CloudWatch SQL query using countMetric
(Ratio metric):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-calendar-occurrences-ratio-sql
project: cloudwatch
spec:
budgetingMethod: Occurrences
description: ""
indicator:
metricSource:
name: cloudwatch
service: cloudwatch-service
objectives:
- target: 0.9
countMetrics:
good:
cloudwatch:
region: eu-central-1
sql: 'SELECT AVG(CPUUtilization) FROM "AWS/EC2"'
incremental: false
total:
cloudwatch:
region: eu-central-1
sql: 'SELECT MAX(CPUUtilization) FROM "AWS/EC2"'
displayName: ""
value: 1
timeWindows:
- calendar:
startTime: "2020-11-14 12:30:00"
timeZone: Etc/UTC
count: 1
isRolling: false
unit: Day
Important notes:
Both, Ratio and Threshold metrics for CloudWatch use the same parameters.
For Ratio metric, define these parameters separately for the Good/Bad Metric and Total Metric.
When using SQL Query only these fields are required:
region
is mandatory. It is a regional code in AWS. Use one of the regional codes listed here. Note: CloudWatch SQL query is available in all AWS Regions, except China.sql
is mandatory. It is an SQL query that enables you to compare, aggregate, and group your metrics by labels to gain real-time operational insights.
CloudWatch SLOs using multiple metrics (JSON)
- rawMetric
- countMetric
Here’s an example of CloudWatch JSON query using rawMetric
(Threshold metric):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-rawmetric-via-json
project: cloudwatch
spec:
budgetingMethod: Occurrences
description: ""
indicator:
metricSource:
kind: Agent
name: cloudwatch
project: cloudwatch
objectives:
- displayName: ""
op: lte
rawMetric:
query:
cloudWatch:
json: |-
[
{
"Id": "e1",
"Expression": "m1 / m2",
"Period": 60
},
{
"Id": "m1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/ApplicationELB",
"MetricName": "HTTPCode_Target_2XX_Count",
"Dimensions": [
{
"Name": "LoadBalancer",
"Value": "app/main-default-appingress-350b/904311bedb964754"
}
]
},
"Period": 60,
"Stat": "SampleCount"
},
"ReturnData": false
},
{
"Id": "m2",
"MetricStat": {
"Metric": {
"Namespace": "AWS/ApplicationELB",
"MetricName": "RequestCount",
"Dimensions": [
{
"Name": "LoadBalancer",
"Value": "app/main-default-appingress-350b/904311bedb964754"
}
]
},
"Period": 60,
"Stat": "SampleCount"
},
"ReturnData": false
}
]
region: eu-central-1
target: 0.8
value: 0.9
service: cloudwatch-service
timeWindows:
- count: 1
isRolling: true
period:
begin: "2021-11-10T14:49:37Z"
end: "2021-11-10T15:49:37Z"
unit: Hour
Here’s an example of CloudWatch JSON query using countMetric
(Ratio metric):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: cloudwatch-timeslices-json
project: cloudwatch
spec:
budgetingMethod: Timeslices
description: ""
indicator:
metricSource:
name: cloudwatch
objectives:
- countMetrics:
good:
cloudWatch:
json: |
[
{
"Id": "e1",
"MetricStat": {
"Metric": {
"Namespace": "AWS/ApplicationELB",
"MetricName": "HTTPCode_Target_2XX_Count",
"Dimensions": [
{
"Name": "LoadBalancer",
"Value": "app/main-default-appingress-350b/123456789"
}
]
},
"Period": 60,
"Stat": "SampleCount"
}
}
]
region: eu-central-1
incremental: false
total:
cloudWatch:
json: |
[
{
"Id": "e2",
"MetricStat": {
"Metric": {
"Namespace": "AWS/ApplicationELB",
"MetricName": "RequestCount",
"Dimensions": [
{
"Name": "LoadBalancer",
"Value": "app/main-default-appingress-350b/123456789"
}
]
},
"Period": 60,
"Stat": "SampleCount"
}
}
]
region: eu-central-1
displayName: ""
target: 0.5
timeSliceTarget: 0.5
value: 1
service: cloudwatch-service
timeWindows:
- count: 1
isRolling: true
period:
begin: "2021-11-10T12:19:58Z"
end: "2021-11-10T13:19:58Z"
unit: Hour
Important Notes:
Both, Ratio and Threshold metrics for CloudWatch use the same parameters.
For Ratio metric, define these parameters separately for the Good/Bad Metric and Total Metric.
When using Multiple Queries (JSON) it is important to remember about:
region
field is mandatory. It is a regional code in AWS. Use one of the regional codes listed here.json
field is mandatory. It is a JSON query that enables you to query multiple CloudWatch metrics and use math expressions to create new time series based on these metrics.
The following JSON validation applies:
The JSON query must be valid.
The JSON query should be an array of metrics.
Only one
ReturnData
field can be set to true (when it is not set, by default it is true), and the rest of theReturnData
fields in other metrics has to be set explicitly to false.The
Period
field inMetricStat
is required and it has to be equal to 60, ifMetricStat' does not exist
, thePeriod
field should be set in the base object to 60.
For further details on CloudWatch metric math functions, go to Using Metric Math | Amazon CloudWatch Documentation.
Querying the CloudWatch Server
Once the SLO is set up, Nobl9 queries the CloudWatch server every 60 seconds.
CloudWatch API Rate Limits
For GetMetricData
API, CloudWatch has limit of 50TPS per Region set by default. This is the maximum number of operation requests you can make per second. For more information, refer to the CloudWatch service quotas | CloudWatch Documentation.
CloudWatch has minimum query and store period - 1 second. By default, CloudWatch stores data with a 1-minute period.
CloudWatch retains metric data differently for various store period. For more information, refer to the GetMetricData | CloudWatch Documentation.
Known Limitations
CloudWatch SQL query is available in all AWS Regions, except China.
Useful Links
Put Metric Data | Amazon CloudWatch Documentation
Get Metric Data | Amazon CloudWatch Documentation
Amazon CloudWatch Concepts | Amazon CloudWatch Documentation
CloudWatch Statistics Definitions | Amazon CloudWatch Documentation
AWS Regional Endpoints | Amazon CloudWatch Documentation
CloudWatch Metrics Insights | Amazon CloudWatch Documentation
CloudWatch Service Quotas | CloudWatch Documentation
Agent Metrics | Nobl9 Documentation
Creating SLOs via Terraform | Nobl9 Terraform Documentation
Creating Agents via Terraform | Nobl9 Terraform Documentation