Search code examples
google-cloud-stackdrivergoogle-cloud-monitoringuptimeuptime-monitoringwebsite-monitoring

How to get the Uptime Percentage from Uptime check


Uptime Percentage

I want to fetch the Uptime percentage from the above image to a third party application I am making. I have gone through various documentation but couldn't find anything!

Can anyone guide me through?


Solution

  • It's not possible for now to generate such metric / graph to show uptime percentage of the VM's.

    You may try to extract that information using cloud trace API.

    Another approach may be to use MQL query to create a custom metric to show total uptime agregated by hours/days etc.

    fetch gce_instance
    | metric 'compute.googleapis.com/instance/uptime'
    | filter (metric.instance_name == 'instance-1')
    | align delta(1d)
    | every 1d
    | group_by [], [value_uptime_mean: mean(value.uptime)]
    

    enter image description here

    Additionally you may find those answers helpful:

    How to generate uptime reports through Google Cloud Stackdriver?

    How to get uptime total and percentage of GCP compute vm instance through MQL?

    Get google cloud uptime history to a third party application