title: How to use python+stackdriver to query idle instances in gcp google cloud?
body: <p>How can we query those bulk idle vm in GCP? Next I want shutdown or destroy them. I suppose we can refer uptime and load average to judge the idle resource. Here i cloned this sample:
  <a href="https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/monitoring/api/v3/uptime-check-client" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/monitoring/api/v3/uptime-check-client</a>
  It didn't give me useful information.</p>
  
  <pre><code>python snippets.py -h
      list-uptime-check-configs
      list-uptime-check-ips
      create-uptime-check
      get-uptime-check-config
      delete-uptime-check-config
      update-uptime-check-config
  </code></pre>
  
  <p>Tried all above commands, but how can i get all vm uptime list in my gcp project?</p>
  
  <p>We have many projects in Google Cloud, each project running hundreds of instances,  these instances are frequently creation or destroy  in my team. Tester will delete instance once test job done. These instance created by testers, and create them in the future if needed. But if the user forgot delete it, then it's a wast.  So we want find out those idle instance and destroy them, and then save money.</p>