Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with query for steampipe aws Cloudwatch metrics #2300

Open
jijopjoy80 opened this issue Sep 6, 2024 · 5 comments
Open

Bug with query for steampipe aws Cloudwatch metrics #2300

jijopjoy80 opened this issue Sep 6, 2024 · 5 comments
Assignees
Labels
bug Something isn't working stale No recent activity has been detected on this issue/PR and it will be closed

Comments

@jijopjoy80
Copy link

Describe the bug
AWS CW metrics query is returning proper result(it shows error) for against a custom namespace for cpu_usae,mem_usage and disk_usage

Steampipe version (steampipe -v)
Steampipe v0.23.3

To reproduce
Query no:1 steampipe query "SELECT
timestamp,
value as cpu_usage
FROM
aws_cloudwatch_metric_data_point
WHERE
metric_name = 'system.cpu.usage.value'
AND period = 60 -- aggregation period in seconds
AND timestamp > now() - interval '5 minutes' -- last 5 minutes of data
ORDER BY
timestamp DESC;
"Query no:2 teampipe query " SELECT
metric_name,
metric_id,
namespace,
dimensions
FROM
aws_cloudwatch_metric
WHERE
namespace = 'MyAppli*****/Me******';"
Expected behavior
It should give the cpu_usage from Custom metrics at aws cloud watch for metric_name = 'system.cpu.usage.value' from table aws_cloudwatch_metric_data_point

Additional context
Actually aws_cloudwatch_metric_data_point table is empty.

@jijopjoy80 jijopjoy80 added the bug Something isn't working label Sep 6, 2024
@jijopjoy80
Copy link
Author

Screenshot_CWmetrics_cpuusage

@jijopjoy80
Copy link
Author

this is the screenshot attached.output for steampipe query for cpuusage for custom namesapce metrics is not giving expected results

@misraved misraved transferred this issue from turbot/steampipe Sep 6, 2024
@ParthaI
Copy link
Contributor

ParthaI commented Sep 10, 2024

Hello @jijopjoy80,

I reviewed the issue you mentioned, and the error shown in the screenshot is expected. It occurs because the columns in your SELECT statement are not part of the table schema for aws_cloudwatch_metric_data_point.

Here are the available columns in the aws_cloudwatch_metric_data_point table:

> .inspect aws_cloudwatch_metric_data_point
+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| column             | type                     | description                                                                                                                                                                                                                                                         |
+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| _ctx               | jsonb                    | Steampipe context in JSON form.                                                                                                                                                                                                                                     |
| account_id         | text                     | The AWS Account ID in which the resource is located.                                                                                                                                                                                                                |
| expression         | text                     | This field can contain either a Metrics Insights query, or a metric math expression to be performed on the returned data.                                                                                                                                           |
| id                 | text                     | The short name you specified to represent this metric.                                                                                                                                                                                                              |
| label              | text                     | The human-readable label associated with the data.                                                                                                                                                                                                                  |
| metric_stat        | jsonb                    | The metric to be returned, along with statistics, period, and units. Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data.                                                                           |
| partition          | text                     | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).                                                                                                                                                                                    |
| period             | bigint                   | The granularity, in seconds, of the returned data points.                                                                                                                                                                                                           |
| region             | text                     | The AWS Region in which the resource is located.                                                                                                                                                                                                                    |
| scan_by            | text                     | The order in which data points should be returned. TimestampDescending returns the newest data first and paginates when the MaxDatapoints limit is reached. TimestampAscending returns the oldest data first and paginates when the MaxDatapoints limit is reached. |
| source_account_id  | text                     | The ID of the account where the metrics are located.                                                                                                                                                                                                                |
| sp_connection_name | text                     | Steampipe connection name.                                                                                                                                                                                                                                          |
| sp_ctx             | jsonb                    | Steampipe context in JSON form.                                                                                                                                                                                                                                     |
| status_code        | text                     | The status of the returned data. Complete indicates that all data points in the requested time range were returned. PartialData means that an incomplete set of data points were returned.                                                                          |
| timestamp          | timestamp with time zone | The timestamp for the data points, formatted in Unix timestamp format.                                                                                                                                                                                              |
| timezone           | text                     | You can use timezone to specify your time zone so that the labels of returned data display the correct time for your time zone.                                                                                                                                     |
| title              | text                     | Title of the resource.                                                                                                                                                                                                                                              |
| value              | double precision         | The data point for the metric corresponding to Timestamp.                                                                                                                                                                                                           |
+--------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Have you had a chance to review the table documentation for aws_cloudwatch_metric_data_point? It includes examples and usage instructions, which may help guide you in building your query according to your needs.

Let me know if I misunderstood the issue or if you need further clarification.

Thanks!

@ParthaI
Copy link
Contributor

ParthaI commented Sep 17, 2024

Hello @jijopjoy80, Did you get a chance to take a look at the above comment?

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale No recent activity has been detected on this issue/PR and it will be closed label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale No recent activity has been detected on this issue/PR and it will be closed
Projects
None yet
Development

No branches or pull requests

2 participants