CloudWatch Datasource Integration

Knowi provides built-in support to create a dataset with CloudWatch as a datasource and develop multiple visualizations on top of it, each with a transformed view on the original data from the dataset. Before you can create your dashboard with CloudWatch, you need to add CloudWatch as a data source and query against it.

Add CloudWatch Datasource

  1. Click on the Queries from the left sidebar menu.

  2. Click on the New Datasource + button from the top-right corner of the interface.

  3. Select Amazon CloudWatch from API & Cloud Services category

  4. Add the following details to configure your CloudWatch datasource:

    a. Datasource Name: Enter a name for your datasource

    b. Default Region: Select the AWS Region from the dropdown list where your AWS resources reside.

    c. Access Key ID & Access Key Secret: Enter the Access Key ID & Secret Access Key to complete the authentication and grant Knowi the permission to read CloudWatch metrics.

    Note: Access Key Id and Secret Access Key are used for API access to AWS services.

    d. IAM Role ARN: Alternatively, you can perform the authentication and grant permission using the IAM role by entering the IAM Role ARN. ARN is a unique identifier for AWS resources specifying the role to assume.

    Note: AssumeRole creates temporary security credentials that can be used for API access to AWS services. If the authentication is done using AssumeRole, then you are not required to enter the Access Key ID and Secret Access Key.

    e. External ID: Optional information that you can use in an IAM role trust policy to designate who can assume the role. If you are an AWS account owner and have defined a role for a third party, you can ask this third party for the external ID that it will include when it while assuming your role. You can use this external ID in your role's trust policy to make sure that the third party can assume your role only when it is acting under the specific circumstances that you intend. In this way, only a particular party having the external ID can assume the roles, rather than everyone in the account.

  5. Establish Network connectivity and click on the Test Connection button.

    Note: The connection validity of the network can be tested only if it has been established via Direct Connectivity or SSH tunnel. For more information on connectivity and datasource, please refer to the documentation on- Connectivity & Datasources.

  6. Click on the Save and start Querying.

Connect-cloudwatch

Query CloudWatch Datasource

There are two options for querying CloudWatch metrics: Choose Metrics visually or use the Editor for Expression-based queries using AWS search expressions.

In the example below, we are using the Visual Builder for the Metric Query to return all metrics in the namespace AWS/EC2 for us-east-1 region, with a CPUUtilization metric and any value for the InstanceId dimension.

Visual Query Mode

Region

Select the region from which you want the Query to return the metrics in the namespace.

Metrics are stored separately in different Regions and while generating the Query with Knowi, you can define only one region at a time. In this case, we have selected the us-east-1 region.

Note: If this field is left empty, the region defined in the datasource shall be used.

Namespace

Select the namespace from the dropdown list. A namespace is a container for CloudWatch metrics and Knowi accepts only a single namespace. In this case, we have selected AWS/EC2.

Metrics

Define the single or multiple metrics from the dropdown list. A metric represents a time-ordered set of data points that are published to CloudWatch and it exists only in the Region in which it is created. In this case, we have selected the metric- CPUUtilization.

Statistics

Select a single or multiple statistics to retrieve from the CloudWatch for the metric(s) you have specified. Statistics are metric data aggregations over specified periods of time. In this case, we have selected two statistics i.e. Average and Maximum.

Note: CloudWatch provides statistics based on the metric data points provided by other AWS services to CloudWatch.

Dimensions

Select the dimensions of the metric you are querying from the dropdown list.

A dimension is a name/value pair that is part of the identity of a metric. Every metric has specific characteristics that describe it, and you can think of dimensions as categories for those characteristics.

Note: You can monitor a dynamic list of metrics by using the asterisk for one or more dimension values.

Combine dimensions

Tick the box to combine dimensions for each metric. For example- if there are 2 dimensions and 2 metrics, each metric will have 2 dimensions.

Note: If the option is unchecked, each dimension will only apply to one metric. In this case, with 2 dimensions and 2 metrics, there will be 4 separate metrics, with only one dimension applied to each metric.

From - To

Select the time range you want to retrieve the results from. In this case, we have selected Last 30 minutes.

Note: You can also define the custom Time Range from the dropdown list.

Period

While retrieving the statistics for a metric, you are required to specify the Period, such as ten minutes, to use for calculating each statistical value. A period is the length of time associated with a specific Amazon CloudWatch statistic. In this case, we have selected 10 seconds.

Periods are defined in numbers of seconds, and valid values for period are 1, 5, 10, 30, or any multiple of 60.

Note: If the period field is left blank, then it calculates automatically based on the time range and cloudwatch retention policy.

Click on the Preview button to check the results of your Query.

Query Mode: Expression

Expression allows users to use CloudWatch search expression. Define the Region, Time Range, and write CloudWatch expression using the Query Editor.

To learn more about search expressions, visit the CloudWatch documentation.

Query Mode: Meta

Meta provides the users with the ability of listing Regions, Namespaces, Metrics, Statistics, Dimensions, and Dimension Values.