API to uptime and downtime percentage for a instance for a certain period of time

169 views
Skip to first unread message

Bharath

unread,
Sep 22, 2020, 11:22:59 AM9/22/20
to Google Stackdriver Discussion Forum

I am trying to prepare a VM Availability Report showing the uptime and downtime in % 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. Can anyone pls tell me what is the difference between the 2 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?

Thanks for your help


Reply all
Reply to author
Forward
0 new messages