Verifying VM Manager setup

Use the following checklist to verify that VM Manager is set up properly.

For information about setting up VM Manager, see Setting up VM Manager.

Before you begin

Checklist overview

Check if OS Config API is enabled

gcloud services list --enabled

If the API is enabled, the output resembles the following:

osconfig.googleapis.com              OS Config API

If the API is not enabled, enable the OS Config API.

Check if metadata is enabled

Linux

For project metadata, on the VM, complete the following steps:

  1. Query the project attributes endpoint:

    curl "http://metadata.google.internal/computeMetadata/v1/project/attributes/" \
    -H "Metadata-Flavor: Google"
    

    If the agent metadata value is set, the output resembles the following:

    enable-osconfig
    
  2. If the enable-osconfig value displays, query the endpoint:

    curl "http://metadata.google.internal/computeMetadata/v1/project/attributes/enable-osconfig" \
    -H "Metadata-Flavor: Google"

    If enabled, the endpoint returns TRUE.

If the metadata is not enabled, enable the OS Config metadata.

Windows

For project metadata, on a VM, open a PowerShell terminal as an administrator and run the following command:

  1. Query the project attributes endpoint:

    $value = (Invoke-RestMethod `
             -Headers @{'Metadata-Flavor' = 'Google'} `
             -Uri "http://metadata.google.internal/computeMetadata/v1/project/attributes/")
    $value
    

    If the agent metadata value is set, the output resembles the following:

    enable-osconfig
    
  2. If the enable-osconfig value displays, query the endpoint:

    $value = (Invoke-RestMethod `
             -Headers @{'Metadata-Flavor' = 'Google'} `
             -Uri "http://metadata.google.internal/computeMetadata/v1/project/attributes/")
    $value
    

    If enabled, the endpoint returns TRUE.

If the metadata is not enabled, enable the OS Config metadata.

Check if the OS Config agent is installed and running

Linux

To check whether your Linux VM has the agent installed, run the following command:

sudo systemctl status google-osconfig-agent

If the agent is installed and running, the output resembles the following:

google-osconfig-agent.service - Google OSConfig Agent
Loaded: loaded (/lib/systemd/system/google-osconfig-agent.service; enabled; vendor preset:
Active: active (running) since Wed 2020-01-15 00:14:22 UTC; 6min ago
Main PID: 369 (google_osconfig)
 Tasks: 8 (limit: 4374)
Memory: 102.7M
CGroup: /system.slice/google-osconfig-agent.service
        └─369 /usr/bin/google_osconfig_agent

If the agent is not installed, install the OS Config agent.

Windows

To check whether your Windows VM has the agent installed, run the following command:

PowerShell Get-Service google_osconfig_agent

If the agent is installed and running, the output resembles the following:

Status   Name               DisplayName
------   ----               -----------
Running  google_osconfig... Google OSConfig Agent

If the agent is not installed, install the OS Config agent.

Check if the service account is enabled

For information about service account requirements, see Setup overview.

Linux

On the VM, run the following:

sudo service google-osconfig-agent status

The output should at least include the default service account.

default/

Windows

On the VM, open a PowerShell terminal as an administrator and run the following command:

Get-Service -Name google_osconfig_agent

The output should at least include the default service account.

default/

Check if the VM can communicate with the VM Manager API

If your VM is running within a private VPC network and does not have public internet access, check that you have enabled Private Google Access.

After you enable Private Google Access, check that the agent can communicate with the VM Manager API .

For example, in the VM, try running one of the following commands:

  • List patch jobs

    gcloud compute os-config patch-jobs list
  • List guest policies

    gcloud beta compute os-config guest-policies list
  • List VMs that have inventory data

    gcloud compute instances os-inventory list-instances