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 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.

  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
    

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 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 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.

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

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

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

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