steampipe plugin install gcp

Table: gcp_compute_instance_metric_cpu_utilization_daily - Query GCP Compute Engine Instances using SQL

Google Cloud Compute Engine is a service that provides secure and customizable compute instances that can be used to build and host your applications. These instances are highly scalable and flexible, offering a variety of machine types to suit your needs. Compute Engine instances can be managed through the Google Cloud Console, the RESTful API, or the command-line interface.

Table Usage Guide

The gcp_compute_instance_metric_cpu_utilization_daily table provides insights into the daily CPU utilization metrics of Google Cloud Compute Engine instances. As a system administrator or a DevOps engineer, you can explore instance-specific details through this table, including the CPU usage patterns, to manage and optimize resource allocation effectively. Use this table to monitor the performance of your instances, identify those with high CPU usage, and make informed decisions about scaling your resources.

GCP Monitoring Metrics provide data about the performance of your systems. The gcp_compute_instance_metric_cpu_utilization_daily table provides metric statistics at 24 hour intervals for the most recent 5 days.

Examples

Basic info

Analyze the daily CPU utilization metrics of your Google Cloud Compute instances to gain insights into usage patterns and performance. This can be particularly useful for capacity planning, identifying resource-intensive instances, and optimizing costs.

select
name,
timestamp,
minimum,
maximum,
average,
sample_count
from
gcp_compute_instance_metric_cpu_utilization_daily
order by
name,
timestamp;
select
name,
timestamp,
minimum,
maximum,
average,
sample_count
from
gcp_compute_instance_metric_cpu_utilization_daily
order by
name,
timestamp;

CPU Over 80% average

Analyze the instances where CPU utilization exceeds 80% on average. This query can help in identifying potential performance issues and ensuring optimal resource allocation.

select
name,
timestamp,
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_compute_instance_metric_cpu_utilization_daily
where
average > 0.80
order by
name,
timestamp;
select
name,
timestamp,
round(minimum, 2) as min_cpu,
round(maximum, 2) as max_cpu,
round(average, 2) as avg_cpu,
sample_count
from
gcp_compute_instance_metric_cpu_utilization_daily
where
average > 0.80
order by
name,
timestamp;

Schema for gcp_compute_instance_metric_cpu_utilization_daily

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
averagedouble precisionThe average of the metric values that correspond to the data point.
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.
nametext=The name of the instance.
projecttextThe 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.
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_compute_instance_metric_cpu_utilization_daily