Instanz für das Monitoring und Logging durch den Ops-Agenten erstellen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Der Ops-Agent erfasst Telemetriedaten für Instanzen, die Sie dann für die Fehlerbehebung und Leistungsoptimierung verwenden können.
Hinweise
Richten Sie die Authentifizierung ein, falls Sie dies noch nicht getan haben.
Bei der Authentifizierung wird Ihre Identität für den Zugriff auf Google Cloud -Dienste und APIs überprüft. Zum Ausführen von Code oder Beispielen aus einer lokalen Entwicklungsumgebung können Sie sich so bei Compute Engine authentifizieren:
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
Installieren Sie die Google Cloud CLI.
Initialisieren Sie die Google Cloud CLI nach der Installation mit dem folgenden Befehl:
Wenn Sie die REST API-Beispiele auf dieser Seite in einer lokalen Entwicklungsumgebung verwenden möchten, nutzen Sie die Anmeldedaten, die Sie der gcloud CLI bereitstellen.
Installieren Sie die Google Cloud CLI.
Initialisieren Sie die Google Cloud CLI nach der Installation mit dem folgenden Befehl:
Bitten Sie Ihren Administrator, Ihnen die folgenden IAM-Rollen für das Projekt zuzuweisen, um die Berechtigungen zu erhalten, die Sie zum Erstellen einer Instanz für die Ops-Agent-Überwachung und -Protokollierung benötigen:
Instanz für das Ops-Agent-Monitoring und -Logging erstellen
Sie können eine Instanz, die für das Ops-Agent-Monitoring und -Logging konfiguriert ist, nur über die Google Cloud Console erstellen. In diesem Abschnitt wird kurz beschrieben, wie Sie den Ops-Agent während der Erstellung einer Instanz installieren. Weitere Informationen finden Sie auch unter Ops-Agent während der Instanzerstellung installieren.
Rufen Sie in der Google Cloud Console die Seite Instanz erstellen auf.
Wenn Sie dazu aufgefordert werden, wählen Sie Ihr Projekt aus und klicken auf Weiter.
Die Seite Instanz erstellen wird angezeigt und enthält den Bereich Maschinenkonfiguration.
Klicken Sie im Navigationsbereich auf Observability. Der Bereich Beobachtbarkeit wird angezeigt.
Wählen Sie im Bereich Ops-Agent das Kästchen Ops-Agent für Monitoring und Logging installieren aus.
Wenn Sie dieses Kästchen anklicken, wird VM Manager im Modus für eingeschränkten Funktionsumfang aktiviert und eine Zuweisung von Betriebssystemrichtlinien zur Installation von Ops-Agent auf der Instanz erstellt.
Klicken Sie zum Erstellen und Starten der Instanz auf Erstellen.
Ops-Agent auf vorhandenen Instanzen installieren
Sie können den Ops-Agent über die Google Cloud -Konsole, die gcloud CLI oder ein Automatisierungstool auf einer Flotte von Instanzen oder auf einzelnen Instanzen installieren.
Eine ausführliche Anleitung finden Sie unter Ops-Agent installieren.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThe Ops Agent collects telemetry data for instances, aiding in troubleshooting and performance tuning.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to Google Cloud services and APIs is necessary, and can be done through the Google Cloud console, gcloud CLI, or REST API.\u003c/p\u003e\n"],["\u003cp\u003eCreating an instance for Ops Agent monitoring and logging can be done via the Google Cloud console by enabling the "Install the Ops Agent for Monitoring and Logging" option during instance creation.\u003c/p\u003e\n"],["\u003cp\u003eThe Ops Agent can also be installed on existing instances using the Google Cloud console, gcloud CLI, or an automation tool.\u003c/p\u003e\n"],["\u003cp\u003eTo install the agent, required roles include Compute Instance Admin (v1) and OSPolicyAssignment Editor.\u003c/p\u003e\n"]]],[],null,["# Create an instance for Ops Agent monitoring and logging\n\n*** ** * ** ***\n\nThe [Ops Agent](/stackdriver/docs/solutions/agents/ops-agent) collects telemetry data for instances that you can then use for troubleshooting and performance tuning.\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity 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:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles\n\n\nTo get the permissions that\nyou need to create an instance for Ops Agent monitoring and logging,\n\nask your administrator to grant you the\nfollowing IAM roles on the project:\n\n- [Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\n- To install the Ops Agent on the instance: [OSPolicyAssignment Editor](/iam/docs/roles-permissions/osconfig#osconfig.osPolicyAssignmentEditor) (`roles/osconfig.osPolicyAssignmentEditor`)\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nCreate an instance for the Ops Agent monitoring and logging\n-----------------------------------------------------------\n\nYou can create an instance that's configured for Ops Agent monitoring and\nlogging only by using the Google Cloud console. This section briefly describes how\nto install the Ops Agent while creating an instance. For more information, also\nsee [Install Ops Agent during instance creation](/stackdriver/docs/solutions/agents/ops-agent/install-agent-vm-creation).\n\n1. In the Google Cloud console, go to the **Create an instance** page.\n\n [Go to Create an instance](https://console.cloud.google.com/compute/instancesAdd)\n\n If prompted, select your project and click **Continue**.\n\n The **Create an instance** page appears and displays the\n **Machine configuration** pane.\n2. In the navigation pane, click **Observability** . The **Observability**\n pane appears.\n\n3. In the **Ops Agent** section, select the\n **Install the Ops Agent for Monitoring and Logging** checkbox.\n\n Selecting this checkbox enables VM Manager in limited\n capability mode and it creates an OS policy assignment for installing\n Ops Agent on the instance.\n4. Optional: Specify other configuration options. For more information, see\n [Configuration options during instance creation](/compute/docs/instances/instance-creation-overview#new-instance-configuration-options).\n\n5. To create and start the instance, click **Create**.\n\nInstall the Ops Agent on existing instances\n-------------------------------------------\n\nYou can use the Google Cloud console, the gcloud CLI, or an automation\ntool to install Ops Agent on a fleet of instances or on individual instances.\nFor detailed instructions, see\n[Install the Ops Agent](/stackdriver/docs/solutions/agents/ops-agent/install-index).\n| **Note:** If you install the Ops Agent, then you might be charged for the metrics and logs that the agent sends to your Google Cloud project. For more information, see [Google Cloud Observability pricing](/stackdriver/pricing).\n\nWhat's next\n-----------\n\n- Learn how to [check the status of an instance](/compute/docs/instances/instance-life-cycle) to see when it is ready to use.\n- Learn how to [connect to your instance0](/compute/docs/instances/connecting-to-instance)."]]