steampipe plugin install gcp

Table: gcp_sql_database_instance_metric_cpu_utilization_hourly - Query Google Cloud SQL Database Instances using SQL

Google Cloud SQL is a fully-managed database service that makes it easy to set up, maintain, manage, and administer your relational databases on Google Cloud Platform. The service offers seamless scalability, secure connections, and the flexibility to support various SQL workloads. Google Cloud SQL Database Instances are the building blocks of this service where the databases are hosted.

Table Usage Guide

The gcp_sql_database_instance_metric_cpu_utilization_hourly table provides insights into the CPU utilization of Google Cloud SQL Database Instances on an hourly basis. As a database administrator or DevOps engineer, you can use this table to monitor and analyze the CPU usage of your instances, helping you to identify resource-intensive operations, potential performance issues, and opportunities for optimization. This information is crucial for maintaining the efficiency and reliability of your database operations.

GCP Monitoring metrics provide data about the performance of your systems. The gcp_sql_database_instance_metric_cpu_utilization_hourly table provides metric statistics at 1 hour intervals for the most recent 60 days.

Examples

Basic info

Explore the CPU utilization of your Google Cloud SQL database instances over the past hour. This can help you understand their performance and identify any instances that may be under or over-utilized.

select
instance_id,
minimum,
maximum,
average,
sample_count,
timestamp
from
gcp_sql_database_instance_metric_cpu_utilization_hourly
order by
instance_id;
select
instance_id,
minimum,
maximum,
average,
sample_count,
timestamp
from
gcp_sql_database_instance_metric_cpu_utilization_hourly
order by
instance_id;

Intervals averaging over 80%

Identify instances where the CPU utilization of your Google Cloud SQL database averages over 80% to help manage resources and optimize performance.

select
instance_id,
round(minimum :: numeric, 2) as min_cpu,
round(maximum :: numeric, 2) as max_cpu,
round(average :: numeric, 2) as avg_cpu,
sample_count
from
gcp_sql_database_instance_metric_cpu_utilization_hourly
where
average > 80
order by
instance_id;
select
instance_id,
round(minimum, 2) as min_cpu,
round(maximum, 2) as max_cpu,
round(average, 2) as avg_cpu,
sample_count
from
gcp_sql_database_instance_metric_cpu_utilization_hourly
where
average > 80
order by
instance_id;

Intervals averaging < 1%

Analyze the CPU utilization of your Google Cloud SQL database instances to identify those with an average CPU utilization of less than 1%. This can be particularly useful in optimizing resource allocation and reducing costs by pinpointing underutilized instances.

select
instance_id,
round(minimum :: numeric, 2) as min_cpu,
round(maximum :: numeric, 2) as max_cpu,
round(average :: numeric, 2) as avg_cpu,
sample_count
from
gcp_sql_database_instance_metric_cpu_utilization_hourly
where
average < 1
order by
instance_id;
select
instance_id,
round(minimum, 2) as min_cpu,
round(maximum, 2) as max_cpu,
round(average, 2) as avg_cpu,
sample_count
from
gcp_sql_database_instance_metric_cpu_utilization_hourly
where
average < 1
order by
instance_id;

Schema for gcp_sql_database_instance_metric_cpu_utilization_hourly

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
averagedouble precisionThe average of the metric values that correspond to the data point.
instance_idtextThe ID of the instance.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
maximumdouble precisionThe maximum metric value for the data point.
metadatajsonbThe associated monitored resource metadata.
metric_kindtextThe metric type.
metric_labelsjsonbThe set of label values that uniquely identify this metric.
metric_typetextThe associated metric. A fully-specified metric used to identify the time series.
minimumdouble precisionThe minimum metric value for the data point.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
resourcejsonbThe associated monitored resource.
sample_countdouble precisionThe number of metric values that contributed to the aggregate value of this data point.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
sumdouble precisionThe sum of the metric values for the data point.
timestamptimestamp with time zoneThe time stamp used for the data point.
unittextThe data points of this time series. When listing time series, points are returned in reverse time order.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION.

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)" -- gcp

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

steampipe_export_gcp --config '<your_config>' gcp_sql_database_instance_metric_cpu_utilization_hourly