0

I am trying to prepare a VM Availability Report for compute Engine Instances. For this I need to gather the following metrics:

  1. The Time VM was available since its creation
  2. The Time VM was down

When I went through the metrics api, in https://cloud.google.com/monitoring/api/metrics_gcp#gcp-monitoring I got the following apis:

  1. compute.googleapis.com/instance/uptime Description: Delta of how long the VM has been running, in seconds
  2. compute.googleapis.com/instance/uptime_total Description: Elapsed time since the VM was started

If I need to get the total time the VM was available since its creation, should I use the uptime or uptime_total? How to find that in % instead of seconds? What is the difference between the two APIs?

If I need to calculate the downtime of the VM I am finding no REST APIs for that, is there any API which can give the times the VM has been down in a month or so?

halfer
  • 19,824
  • 17
  • 99
  • 186
user1403505
  • 895
  • 2
  • 19
  • 42
  • 1
    From the research I carried out it appears that "uptime_total" is a cummulative of "uptime". However, for the "downtime" you might want to consider [uptime_check](https://cloud.google.com/monitoring/uptime-checks/#monitoring_uptime_check_update-console) – Adebisi Sep 22 '20 at 14:03
  • Thanks, if VM is stopped or started multiple times, then if I want to find out the total time it is up, will uptime_total give me that metrics or it will give only from the last time it was started? Actually the vms i use do not have any uptime_check in them, so I am not sure how to find down time? – user1403505 Sep 22 '20 at 14:11
  • 1
    I checked internally with the team working on it, it appears they are same. Note: to get the total number of seconds since VM start, use compute.googleapis.com/instance/uptime_total." As per the uptime_check you can find it in the overview tab under Monitoring section – Adebisi Sep 24 '20 at 17:49
  • Thanks, When I look at compute.googleapis.com/instance/uptime it the documentation is given as : Delta of how long the VM has been running, in seconds. When I look at the metric explorer it shows when the machine is running the vaule is a whole number 1, and in other time it is showing as something like 0.31 or when it is starting as 0.15(when it is starting), I am not understanding this fraction and how it is calculated ? Can you pls help me on this? – user1403505 Sep 26 '20 at 17:43
  • we do have [documentation](https://cloud.google.com/monitoring/charts#chart-type) that provide some explain which you might find helpful – Adebisi Sep 28 '20 at 16:42

0 Answers0