se_brock
se_brock

Reputation: 91

Google compute instance available informations

Is there a gcloud, or python API, equivalence to the information Google supplies in the OS patch management GUI. The GUI lists compute instances with package updates available. I can use gcloud compute os-config vulnerability-reports describe to view CVE reports, but not if a patch is available. Any suggestions on how to obtain this information?

Upvotes: 0

Views: 122

Answers (1)

Siegfred V.
Siegfred V.

Reputation: 1527

I think the method projects.locations.instances.inventories.list will provide you with all the required information

As explained in the documentation, this method will list inventory data for all VM instances in the specified zone. After specifying the parent parameter the output was the following one:

{

  "inventories": [

    {
      "osInfo": {
        "longName": "Deb*** ******** ** (*****)",
        "shortName": "*******",
        "version": "***",
        "architecture": "*******",
        "kernelVersion": "* *** ***** *.**.***-* (****-**-**)",
        "kernelRelease": "*.**.*-**-*****-****",
        "osconfigAgentVersion": "**********",
        "hostname": "***************"
      },

      "name": "***/****8**8***/l********s/*s-**as***-*/i******/2*******98**4/*****",
      "updateTime": "****-**-*****:**:**.******"
    }
  ],
  "nextPageToken": "************=="
}

As explained in this document, the view parameter value should be set to FULL, otherwise its default value will be BASIC. If FULL value is not used, the method won’t provide you with the available packages and the already installed ones.

As seen in this example:

{
      "osInfo": {
        "longName": "Deb*** ******** ** (*****)",
        "shortName": "*********",
        "version": "****",
        "architecture": "*********",
        "kernelVersion": "#********* (*********)",
        "kernelRelease": "*********",
        "osconfigAgentVersion": "*********",
        "hostname": "*********"
      },

      "items": {
        "availablePackage-google-clo*****************-********* ********": {
          "id": "****availablePackage-goo************************************",
          "originType": "*********",
          "type": "*********",
          "availablePackage": {
            "aptPackage": {
              "architecture": "*********",
              "version": "*********",
              "packageName": "***************************"
       …

       …

Upvotes: 1

Related Questions