Life span of the instance/uptime metric GCP

81 Views Asked by At

I have been trying to get the details about how long the VM has been running. Upon researching, I found that the instance/uptime metric could provide this information. However, I'm interested in obtaining monthly data for the past few years.

Despite having a running instance, the metric explorer pages started throwing "no date is available for the selected timeframe".

Is there a retention period for metrics similar to what we have for Cloud Logging?

1

There are 1 best solutions below

0
Kapil Sakhare On BEST ANSWER

When you access the instance through SSH, execute the command ‘uptime -p’ to obtain information about how long the VM has been running, but the standard retention period for all Cloud Monitoring metrics is 6 weeks only.

As per this official GCP documentation (How to query extended retention metrics):

“Longer metric retention enables quarter-over-quarter or year-over-year analysis and reporting, forecasting seasonal trends, retention for compliance, and much more. We recently announced the general availability (GA) of extended metric retention for custom and Prometheus metrics in Cloud Monitoring, increasing retention from 6 weeks to 24 months. Extended retention for custom and Prometheus metrics is enabled by default.

Let’s take an example scenario where you have a Compute Engine VM running a web application. In that web app, you write a metric that tracks a critical user journey for which you want to perform a month-over-month analysis.

To query metric data for a month-over-month comparison, go to Cloud Monitoring and select Metrics Explorer. Select your custom or Prometheus metric and the resource type. Then click on “Custom” in the time range selector above the chart. Previously the time-range selector only allowed you to select up to 6 weeks of metric data; now you can select up to 24 months.”

Google Cloud is slowly rolling out 24 months retention, but it is not generally available yet. You can refer to the above official GCP doc for more details.