Installing the Ops Agent on a single VM

Contact us at google-cloud-ops-agent@google.com if you have any questions, need support, or would like to offer feedback.

The Ops Agent collects logs and metrics on Compute Engine instances, sending your logs to Cloud Logging and your metrics to Cloud Monitoring.

Before you begin

To install the agent, ensure that you have the following:

VMs without remote package access

Installing the Google Cloud's operations suite agent requires access to remote package repositories, for both the agent package and (on Linux) its dependencies.

If you are using VPC-SC or a private network, the network configuration might also affect your ability to install agent dependencies from upstream repositories. The agent packages themselves are accessible by using Private Google Access.

If your VM host's security policy denies access to remote package repositories, we recommend creating a custom VM image with the agent pre-installed and disabling package management in that image.

Installing the agent on a single VM

To install the agent, use the following instructions.

Installing the latest version of the Ops Agent

To install the latest version of the agent, complete the following steps.

LINUX

  1. Open a terminal connection to your VM instance using SSH or a similar tool and ensure you have sudo access.

  2. Change to a directory you have write access to, for example your home directory.

  3. Run:

    curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
    sudo bash add-google-cloud-ops-agent-repo.sh --also-install
    

WINDOWS

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

  3. Run the following PowerShell commands:

    googet addrepo google-cloud-ops-agent-windows https://packages.cloud.google.com/yuck/repos/google-cloud-ops-agent-windows-all
    googet -noconfirm install google-cloud-ops-agent
    

Installing a specific version of the Ops Agent

To install a specific version of the agent, complete the following steps.

CENTOS / RHEL

  1. Open a terminal connection to your VM instance using SSH or a similar tool and ensure you have sudo access.

  2. Change to a directory you have write access to, for example your home directory.

  3. Add the agent's package repository:

    curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
    sudo bash add-google-cloud-ops-agent-repo.sh
    
  4. Install the agent:

    1. List the available versions of the agent in order to select which version to install:

      sudo yum list --showduplicates google-cloud-ops-agent
      
    2. For production environments, you might want to pin to a major version to avoid pulling in major versions that might include backward incompatible changes. To pin to a major version, run:

      sudo yum install -y google-cloud-ops-agent-major-version.*
      

      For example, to pin to the 1.x.x of the agent, run:

      sudo yum install -y google-cloud-ops-agent-1.*
      
    3. If you don't want to pin to a major version, you can select one of the other installation options:

      1. To install a specific version of the agent, run:

          sudo yum install -y google-cloud-ops-agent-version-number
        
      2. To install the latest version of the agent, run:

          sudo yum install -y google-cloud-ops-agent
        

You can delete the installation script after it runs successfully.

  • To verify that the agent is working as expected, run:

    sudo systemctl status google-cloud-ops-agent"*"
    

    The status of the agent should be OK.

If you have trouble with the installation, refer to the Troubleshooting page.

DEBIAN / UBUNTU

  1. Open a terminal connection to your VM instance using SSH or a similar tool and ensure you have sudo access.

  2. Change to a directory you have write access to, for example your home directory.

  3. Add the agent's package repository:

    curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && \
    sudo bash add-google-cloud-ops-agent-repo.sh && \
    sudo apt-get update
    
  4. Install the agent:

    1. List the available versions of the agent in order to select which version to install:

      sudo apt-cache madison google-cloud-ops-agent
      
    2. For production environments, you might want to pin to a major version to avoid pulling in major versions that might include backward incompatible changes. To pin to a major version, run:

      sudo apt-get install -y 'google-cloud-ops-agent=major-version.*'
      

      For example, to pin to the 1.x.x of the agent, run:

      sudo apt-get install -y 'google-cloud-ops-agent=1.*'
      
    3. If you don't want to pin to a major version, you can select one of the other installation options:

      1. To install a specific version of the agent, run:

          sudo apt-get install -y google-cloud-ops-agent=version-number
        
      2. To install the latest version of the agent, run:

          sudo apt-get install -y google-cloud-ops-agent
        

You can delete the installation script after it runs successfully.

  • To verify that the agent is working as expected, run:

    sudo systemctl status google-cloud-ops-agent"*"
    

    The status of the agent should be OK.

If you have trouble with the installation, refer to the Troubleshooting page.

SLES / SUSE

  1. Open a terminal connection to your VM instance using SSH or a similar tool and ensure you have sudo access.

  2. Change to a directory you have write access to, for example your home directory.

  3. Add the agent's package repository:

    curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
    sudo bash add-google-cloud-ops-agent-repo.sh
    
  4. Install the agent:

    1. List the available versions of the agent in order to select which version to install:

      sudo zypper search -s google-cloud-ops-agent
      
    2. For production environments, you might want to pin to a major version to avoid pulling in major versions that might include backward incompatible changes. To pin to a major version, run:

      sudo zypper install -y 'google-cloud-ops-agent<major-version.0.0'
      

      For example, to pin to the 1.x.x of the agent, run:

      sudo zypper install -y 'google-cloud-ops-agent<2.0.0'
      
    3. If you don't want to pin to a major version, you can select one of the other installation options:

      1. To install a specific version of the agent, run:

          sudo zypper install -y google-cloud-ops-agent=version-number
        
      2. To install the latest version of the agent, run:

          sudo zypper install -y google-cloud-ops-agent
        

You can delete the installation script after it runs successfully.

  • To verify that the agent is working as expected, run:

    sudo systemctl status google-cloud-ops-agent"*"
    

    The status of the agent should be OK.

If you have trouble with the installation, refer to the Troubleshooting page.

WINDOWS

To install the agent on a VM instance running Windows, perform the following steps:

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

  3. Run the following PowerShell command:

    1. Add the agent's package repository if you have not yet done so:

      googet addrepo google-cloud-ops-agent-windows https://packages.cloud.google.com/yuck/repos/google-cloud-ops-agent-windows-all
      
    2. To list the available versions, run:

      googet available google-cloud-ops-agent
      
    3. To install a specific version, run:

      googet -noconfirm install google-cloud-ops-agent.x86_64.version-number
      

      For example:

      googet -noconfirm install google-cloud-ops-agent.x86_64.1.0.1@1
      

    To verify that the agent is working as expected, run:

    Get-Service google-cloud-ops-agent
    

    The status of the agent should be Running.

    If you have trouble with the installation, refer to the Troubleshooting page.

Optional tasks

This section describes how to perform common maintenance tasks.

Determining the agent version

To determine the version of the Google Cloud's operations suite agent on your system, run the following commands on your VM instance:

CENTOS / RHEL

Run the following command on Red Hat or CentOS Linux:

rpm --query --queryformat '%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n' \
     google-cloud-ops-agent

DEBIAN / UBUNTU

Run the following command on Debian or Ubuntu:

dpkg-query --show --showformat \
    '${Package} ${Version} ${Architecture} ${Status}\n' \
     google-cloud-ops-agent

SLES / SUSE

Run the following command on SUSE:

rpm --query --queryformat '%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n' \
     google-cloud-ops-agent

WINDOWS

Run the following command on Windows:

googet installed google-cloud-ops-agent

Restarting the agent

You must restart the Google Cloud's operations suite agent to pick up changes in configuration files. To restart the agent, use the following instructions.

LINUX

Run the following command on your instance:

 sudo systemctl restart google-cloud-ops-agent.target

WINDOWS

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

  3. Run the following PowerShell command:

Restart-Service google-cloud-ops-agent -Force

Upgrading the agent

To upgrade the Google Cloud's operations suite agent to the latest release, use the following instructions:

CENTOS / RHEL

Run the following command on Red Hat or CentOS Linux:

sudo yum upgrade google-cloud-ops-agent

DEBIAN / UBUNTU

Run the following commands on Debian or Ubuntu:

sudo apt update && sudo apt install --only-upgrade google-cloud-ops-agent

SLES / SUSE

Run the following command on SUSE:

sudo zypper update google-cloud-ops-agent

WINDOWS

To upgrade to the latest agent release:

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

  3. Run the following PowerShell commands to remove your installed agent and to run the installation command:

    googet -noconfirm remove google-cloud-ops-agent
    googet -noconfirm install google-cloud-ops-agent
    

Uninstalling the agent

To remove the Google Cloud's operations suite agent and its configuration files, use the following instructions.

CENTOS / RHEL

Run the following command on Red Hat or CentOS Linux:

sudo yum remove google-cloud-ops-agent

DEBIAN / UBUNTU

Run the following command on Debian or Ubuntu:

sudo apt remove google-cloud-ops-agent

SLES / SUSE

Run the following command on SUSE Linux:

sudo zypper remove google-cloud-ops-agent

WINDOWS

To uninstall the Ops Agent, follow the following steps:

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

  3. Run the following PowerShell command:

    googet -noconfirm remove google-cloud-ops-agent