The Ops Agent collects telemetry data for instances that you can then use for troubleshooting and performance tuning.
Before you begin
-
If you haven't already, then set up authentication.
Authentication is
the process by which your identity is verified for access to Google Cloud services and APIs.
To run code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
Required roles
To get the permissions that you need to create an instance for Ops Agent monitoring and logging, ask your administrator to grant you the following IAM roles on the project:
-
Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1
) -
To install the Ops Agent on the instance:
OSPolicyAssignment Editor (
roles/osconfig.osPolicyAssignmentEditor
)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Create an instance for the Ops Agent monitoring and logging
You can create an instance that's configured for Ops Agent monitoring and logging only by using the Google Cloud console. This section briefly describes how to install the Ops Agent while creating an instance. For more information, also see Install Ops Agent during instance creation.
In the Google Cloud console, go to the Create an instance page.
If prompted, select your project and click Continue.
The Create an instance page appears and displays the Machine configuration pane.
In the navigation pane, click Observability. The Observability pane appears.
In the Ops Agent section, select the Install the Ops Agent for Monitoring and Logging checkbox.
Selecting this checkbox enables VM Manager in limited capability mode and it creates an OS policy assignment for installing Ops Agent on the instance.
Optional: Specify other configuration options. For more information, see Configuration options during instance creation.
To create and start the instance, click Create.
Install the Ops Agent on existing instances
You can use the Google Cloud console, the gcloud CLI, or an automation tool to install Ops Agent on a fleet of instances or on individual instances. For detailed instructions, see Install the Ops Agent.
What's next
- Learn how to check the status of an instance to see when it is ready to use.
- Learn how to connect to your instance0.