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
Click on the Queries from the left sidebar menu.
Click on the New Datasource + button from the top-right corner of the interface.
Select Amazon CloudWatch from API & Cloud Services category
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 roles 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.
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.
Click on the Save and start Querying.
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
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.
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.
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.
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.
Select the dimensions of the metric you're 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.
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.
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?s 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.