惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
罗磊的独立博客
人人都是产品经理
人人都是产品经理
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
L
Lohrmann on Cybersecurity
博客园 - 【当耐特】
量子位
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
有赞技术团队
有赞技术团队
Cyberwarzone
Cyberwarzone
T
Tor Project blog
V
V2EX
L
LINUX DO - 热门话题
Security Latest
Security Latest
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
NISL@THU
NISL@THU
C
Cisco Blogs
T
Tailwind CSS Blog
G
GRAHAM CLULEY
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
K
Kaspersky official blog
博客园 - 司徒正美
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
S
Schneier on Security
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
J
Java Code Geeks
博客园 - 聂微东
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
T
Threat Research - Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis Monitor Aruba Central in Datadog How we centralize and remediate risks with Datadog Case Management Accelerate incident response with Datadog and ServiceNow Monitor your application and network load balancer logs Understanding Karpenter architecture for Kubernetes autoscaling Tools for collecting metrics and logs from Karpenter Monitor Karpenter with Datadog What your product data is actually saying Key metrics for monitoring Karpenter Securing Datadog’s platform in the AI age: The role of observability data Four ways engineering teams use the Datadog MCP Server to power AI agents Approaching your observability migration with the right mindset Meet the new Bits AI SRE: Deeper reasoning, twice as fast Key learnings from the 2026 State of DevSecOps study Use plain English to query your multi-cloud infrastructure in Resource Catalog Simplifying troubleshooting across the user journey with Datadog Synthetic Monitoring Protect your OCI resources with Datadog Cloud Security This Month in Datadog - February 2026 Amazon EC2 security: How misconfigured and public AMIs expand your cloud attack surface Enable end-to-end visibility into your Java apps with a single command Measure and improve mobile app startup performance with Datadog RUM Evaluating our AI Guard application to improve quality and control cost Identify untested code across every level of your codebase Make use of guardrail metrics and stop babysitting your releases Monitor Versa Networks SD-WAN performance in Datadog Improve performance and reliability with APM Recommendations Remediate transitive vulnerabilities faster with Datadog Software Composition Analysis Generate audit-ready vulnerability and compliance reports with Datadog Sheets Monitor Fortinet FortiManager performance in Datadog Improve test coverage across codebases with Datadog Code Coverage Move fast, don’t break things: Consistent testing standards at scale Enrich logs with ServiceNow CMDB context before routing to any SIEM or logging tool Monitor Lustre with Datadog Make faster, better product decisions with Datadog Product Analytics Surface and remediate runtime posture issues with Workload Protection Findings Protect agentic AI applications with Datadog AI Guard How to optimize JavaScript code with CSS Trace Google Pub/Sub workloads in Cloud Run with Datadog Detect human names in logs with ML in Sensitive Data Scanner How we cut our NLQ agent debugging time from hours to minutes with LLM Observability Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring Datadog acquires Propolis Unify and correlate frontend and backend data with retention filters Scale compliance across global frameworks with Datadog Cloud Security Monitor Arista VeloCloud SD-WAN performance with Datadog Building reliable dashboard agents with Datadog LLM Observability Simplify log collection and aggregation for MSSPs with Datadog Observability Pipelines Mitigation for Node.js denial-of-service vulnerability affecting Datadog APM Automate flaky test fixes with the Bits AI Dev Agent and Test Optimization How we built an AI SRE agent that investigates like a team of engineers Datadog integrations 2025 recap: Observability for AI, security, and hybrid cloud Design effective executive dashboards with Datadog Implement dbt data quality checks with dbt-expectations Bring faster visibility into AWS Lambda functions with remote instrumentation Troubleshoot faster with the GitLab Source Code integration in Datadog How Cambia Health Solutions saved $30,000 monthly with Cloud Cost Management and the Datadog Resource Catalog Normalize any logs for Cloud SIEM with Datadog's OCSF processor Optimizing Datadog at scale: Cost-efficient observability at Zendesk Detect, diagnose, and resolve network issues easily with CNM Network Health Connect engineering errors to user impact in early-stage products Cilium configuration for Kubernetes operations at scale Designing feedback loops for progressive delivery Ship features faster and safer with Datadog Feature Flags Choosing the right OpenTelemetry Collector distribution Route your monitor alerts with Datadog monitor notification rules Automate Cloud SIEM investigations with Bits AI Security Analyst Cloud threat detection: How to identify risky activity across control and data planes Collecting Kafka performance metrics Monitoring Kafka with Datadog Monitoring Kafka performance metrics
How to collect Google Compute Engine metrics
2017-03-08 · via Datadog | The Monitor blog
Evan Mouzakitis

This post is part 2 of a 3-part series on monitoring the health and performance of virtual machines in Google Compute Engine (GCE). Part 1 details key GCE metrics to monitor, this post covers data collection using Google tools, and part 3 explains how to monitor GCE with Datadog.

Google provides a few methods by which you can surface and collect most of the metrics mentioned in part 1 of this series. In this post we will explore how you can access Google Compute Engine metrics, using standard tools that Google provides:

Monitoring API

Google Cloud Platform’s Stackdriver monitoring API is the most full-featured method for extracting platform performance metrics from GCE. You can query the API using common tools typically found on most operating systems, including wget and curl.

Before you can use the Stackdriver API, you must first authenticate using OAuth2.0, which is a multi-step process. Below we’ve outlined two methods by which you can obtain a token to use for API calls:

User account authorization is great for interactive experimentation, but service account is the recommended auth type if you plan to use the REST API in a production environment. If you want to skip the auth process for now, you can still follow along in Google’s API Explorer.

Auth option 1: Service account authorization

By default, all Compute projects come pre-configured with the Compute Engine default service account, whose email invariably follows this format: [PROJECT_NUMBER]-compute@developer.gserviceaccount.com. This service account has the authorization scopes you need to query the Stackdriver API (and much more). To follow along, you can use the default service account, or you can easily create a new service account and use it instead, so long as you create it with a Project Owner, Project Editor, or Project Viewer role.

Create service account key

Once you select a service account, you will need to create a service account key to use in obtaining the OAuth token needed to interact with the API. Navigate to the service accounts page in the console and select your project.

Next, find the Compute Engine default service account (or the new service account you’ve created for this purpose), click the hamburger menu (three stacked dots), select Create key, and choose JSON as the key type. Then, download and save the key.

GCE metrics - Create service account key

With credentials in hand, you are ready to construct a JSON Web Token (JWT) to request an API access token.

Creating a JWT is a multistep process which is easily automated. You can either manually construct the JWT, or download this helper script (Python) to automatically request an API access token using your downloaded credentials. Once you have a token, you’re ready to make an API call.

Auth option 2: User account authorization

First, navigate to the API Manager dashboard for your project and click Credentials.

GCE metrics - Add new OAuth authorization

Next, click the blue Create credentials button, and from the dropdown that follows, select Oauth client ID.

GCE metrics - Add new OAuth authorization

On the next screen, click the Web application radio button, enter http://localhost under Authorized redirect URIs, and click Create.

GCE metrics - Add new OAuth authorization

Copy your client ID and client secret from the popup and store them in a safe, encrypted place.

GCE metrics - Add new OAuth authorization

With your client ID in hand, you are ready to construct an HTTPS request that will enable your Google account to access GCE metrics.

The request below has been split into distinct parts for readability; you must concatenate all the parts together before executing in a browser:

https://accounts.google.com/o/oauth2/v2/auth # Base URL for authorization

?redirect_uri=http://localhost # Redirect URL set in credential creation

&response_type=token # Type of response we want back from Google

&client_id=xx-xx.apps.googleusercontent.com # The client ID copied at credential creation

&scope=https://www.googleapis.com/auth/monitoring.read # The authorization scope needed to access GCE metrics

The token string in the resulting URL is our request token. Once you have a request token, you’re ready to make an API call.

Query the API

The Stackdriver monitoring API allows you to query all of the performance metrics mentioned in part one of this series. The API endpoint for timeseries data follows a regular format, regardless of the timeseries requested: https://monitoring.googleapis.com/v3/projects/$YOUR_PROJECT_NAME/timeSeries/.

The recognized parameters are outlined in the table below.

ParameterTypeDescription (source)
filterstringRestricts the timeseries to be returned. Accepts Boolean operators (AND, OR) to specify metric labels for additional filtering
interval.start_timestring (Timestamp format)The start time for which results should be returned
interval.end_timestring (Timestamp format)The end time for which results should be returned
aggregationobject(Aggregation)Allows aggregation of timeseries over space (ex: average of CPU across all hosts) and time (ex: daily average of CPU use for one machine)
pageSizeintegerMaximum number of results to return
pageTokenstringReturns additional results. If present, must contain the nextPageToken value returned by a previous call to this method
viewenum(TimeSeriesView)Specifies information to be returned about the timeseries

The minimum required parameters are interval.end_time, interval.start_time, and filter.

The token should be passed as an Authorization header of type Bearer; with curl such a header looks like this:

-H "Authorization: Bearer $TOKEN"

Note: If you receive a MissingSecurityHeader response when calling the API, verify that you are not behind a proxy that is stripping your request headers.

Constructing the query

As detailed in the first part of this series, all GCE instance metrics begin with compute.googleapis.com/ and end with the metric names outlined in the metric tables contained in that post (e.g. instance/cpu/utilization for CPU utilization).

We can compose a query to return the list of all CPU utilization metrics from any instance, collected between 9:43 pm and 9:45 pm on January 30, 2017:

=> curl -X GET -H "Authorization: Bearer $TOKEN"\

"https://monitoring.googleapis.com/v3/projects/evan-testing/timeSeries/?filter=metric.type+%3D+%22compute.googleapis.com%2Finstance%2Fcpu%2Futilization%22&\

interval.endTime=2017-01-30T21%3A45%3A00.000000Z\

&interval.startTime=2017-01-30T21%3A43%3A00.000000Z"

{

"timeSeries": [

{

"metric": {

"labels": {

"instance_name": "evan-test"

},

"type": "compute.googleapis.com/instance/cpu/utilization"

},

"resource": {

"type": "gce_instance",

"labels": {

"instance_id": "743374153023006726",

"zone": "us-east1-d",

"project_id": "evan-testing"

}

},

"metricKind": "GAUGE",

"valueType": "DOUBLE",

"points": [

{

"interval": {

"startTime": "2017-01-30T21:44:01.763Z",

"endTime": "2017-01-30T21:44:01.763Z"

},

"value": {

"doubleValue": 0.00097060417263416339

}

},

{

"interval": {

"startTime": "2017-01-30T21:43:01.763Z",

"endTime": "2017-01-30T21:43:01.763Z"

},

"value": {

"doubleValue": 0.00085122420706227329

}

}

]

},

...

]

As you can see in the output above, without any other parameters, GCE will return a list of all timeseries that satisfy the filter rules. You’ll also notice that GCE returns metrics with one-minute granularity.

Aggregating timeseries metrics

Using a combination of aggregators and filters, you can flexibly slice and dice the timeseries along any dimension your metrics are labeled with. Using aggregation is a little more complex than a simple, non-aggregated query. Before timeseries can be considered in aggregate, each individual timeseries must be in alignment with all the others, essentially ensuring that all of the aggregated timeseries are of the same type.

Next we’ll try using an aggregator in a query, this time asking for the average rate of disk write operations at one-minute intervals across all instances whose name begins with evan-, collected between 8:45 pm and 9:00 pm on February 1, 2017:

curl -X GET -H "Authorization: Bearer $TOKEN" \

"https://monitoring.googleapis.com/v3/projects/evan-testing/timeSeries/?\

interval.end_time=2017-02-01T21%3A00%3A00.000000000Z&\

filter=metric.type+%3D+%22compute.googleapis.com%2Finstance%2Fdisk%2Fwrite_ops_count%22+AND+metric.label.instance_name+%3D+starts_with%28%22evan-%22%29&\

interval.start_time=2017-02-01T20%3A45%3A00.000000000Z&\

aggregation.perSeriesAligner=ALIGN_RATE&\

aggregation.alignmentPeriod=60s&\

aggregation.crossSeriesReducer=REDUCE_MEAN"

That query yields:

{

"timeSeries": [

{

"metric": {

"type": "compute.googleapis.com/instance/disk/write_ops_count"

},

"resource": {

"type": "gce_instance",

"labels": {

"project_id": "evan-testing"

}

},

"metricKind": "GAUGE",

"valueType": "DOUBLE",

"points": [

{

"interval": {

"startTime": "2017-02-01T21:00:00Z",

"endTime": "2017-02-01T21:00:00Z"

},

"value": {

"doubleValue": 0.42000000000000004

}

},

{

"interval": {

"startTime": "2017-02-01T20:59:00Z",

"endTime": "2017-02-01T20:59:00Z"

},

"value": {

"doubleValue": 0.45333333333333331

}

},

{

"interval": {

"startTime": "2017-02-01T20:58:00Z",

"endTime": "2017-02-01T20:58:00Z"

},

"value": {

"doubleValue": 0.42333333333333334

}

},

[...]

Check out the documentation for more information on using aggregators.

You can easily query for the rest of the metrics mentioned in part one by substituting the Google metric name for instance%2Fdisk%2Fwrite_ops_count in the example above.

gcloud

The gcloud command line tool is a versatile part of the Google Cloud SDK that allows you to view and manage your Google Cloud Platform resources. It is a veritable Swiss Army knife for GCP and can easily be integrated into existing automation tools (like Ansible or Puppet) for programmatic interaction with GCP resources.

Though you can only access quota-related metrics with gcloud, it is extraordinarily useful for day-to-day operations tasks, so it is likely to be in your existing toolkit, and we wanted to highlight the metric-retrieval capabilities of this handy tool.

Before you can take advantage of this powerful tool, you first must install and configure it.

Install gcloud

Requirements: Python 2.7 Installing the Google Cloud Platform SDK is straightforward:

  1. Download the appropriate package for your system/architecture
  2. Run the install script to add the tool to your path and enable bash completion: ./google-cloud-sdk/install.sh on Linux/MacOS

or run this one-liner (Linux/MacOS only):

curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash

Configure gcloud

The SDK supports two authorization methods: user account (via OAuth) and service account. User account authorization is suggested for single users; if you plan to use gcloud in a production environment, the service account authorization is suggested.

Single user authorization

To authorize a single user, run glcoud init (or gcloud init --console-only if you’re using a headless machine) and follow the prompts. You will be asked to log into your Google Cloud Platform account and provide authorization for the various administrative APIs the tool uses. If you have multiple projects in GCP, you will be asked which project you’d like to use, as well as the default GCE zone you use. Of course, these values are just defaults; you can add configurations for other projects and zones if need be (see gcloud topic configurations for more info).

Service account authorization

The service account authorization flow is as follows:

  1. Navigate to the Service Accounts page in GCP
  2. Create a service account or choose an existing account
  3. Open the hamburger menu (three stacked dots), select Create Key and download the JSON-formatted key file to a location accessible by your Cloud SDK tools
  4. Run gcloud auth activate-service-account --key-file [KEY_FILE]
  5. Delete the key file, as it is no longer needed

Regardless of the authorization method you choose, you can verify your configuration settings with gcloud config list.

Use gcloud

Once gcloud is configured, you can retrieve all of the quota metrics from part one of this series with a simple one-liner:

gcloud compute project-info describe

Because most of the capabilities of gcloud go beyond the scope of this series, you can check out a full list of gcloud commands here.

Stackdriver

Google’s Stackdriver monitoring service offers a simple interface for surfacing and alerting on the GCE metrics mentioned in part one. Using Stackdriver does require you to make a Stackdriver account, which is separate from your GCP account.

GCE metrics - Stackdriver operator console

After creating an account, you will have access to a customizable overview dashboard like the one above. From this interface you can set alerts and create dashboards.

Stackdriver dashboards

Stackdriver dashboards allow you to visualize the instance-level metrics from part one of this series, though it does not report firewall or quota metrics. For GCE, you can add charts for CPU usage, disk read/write I/O and network traffic, as you can see in the dashboard below:

Constructed GCE metrics overview dashboard displaying all of the GCE metrics available for visualization.

Stackdriver alerting

Stackdriver also provides a built-in alerting system, so you can configure alerts on the GCE metrics mentioned above. The free service tier allows you to set up basic email alerts on GCP metrics that cross static thresholds or that are missing data.

Here’s an example alert for extended periods of prolonged CPU usage:

GCE metrics - Setup a CPU alert

From collection to action

In this post we’ve covered three general ways to surface metrics from Google Compute Engine using simple, lightweight tools already available on your system.

For production systems, you will likely want a monitoring platform that readily ingests GCE performance metrics, and also allows you to closely monitor the performance of your infrastructure and applications, even in other environments. And to analyze trends or robustly detect anomalies, you’ll need a platform that retains and analyzes historical data as well as real-time metrics.

At Datadog, we’ve developed integrations with over 1,000 technologies, including GCE and most Google Cloud Platform technologies, to make your infrastructure and applications as observable as possible.

For more details, check out our guide on monitoring GCE with Datadog, or get started right away with a free trial.

Source Markdown for this post is available on GitHub. Questions, corrections, additions, etc.? Please let us know.