Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie die Monitoring API v3 aktivieren und autorisieren. Sie müssen diese API aktivieren, bevor Sie sie verwenden können.
Monitoring API aktivieren
Sie können entweder die Google Cloud Console oder die Google Cloud CLI verwenden, um zu prüfen, ob die Monitoring API aktiviert ist, oder um sie zu aktivieren.
Google Cloud console
Wählen Sie in der Google Cloud Console Google Cloud das Projekt aus, für das Sie die API aktivieren möchten, und rufen Sie dann die Seite APIs und Dienste auf:
Klicken Sie auf die Schaltfläche APIs und Dienste aktivieren.
Suchen Sie nach „Monitoring“.
Klicken Sie in den Suchergebnissen auf "Stackdriver Monitoring API".
Wenn "API aktiviert" angezeigt wird, ist die API bereits aktiviert. Wenn nicht, klicken Sie auf Aktivieren.
gcloud-CLI
Wenn Sie die Google Cloud CLI noch nicht auf Ihrer Workstation installiert haben, lesen Sie den Hilfeartikel gcloud CLI installieren.
Führen Sie den folgenden Befehl auf Ihrer Workstation aus, um festzustellen, ob die Monitoring API aktiviert ist. Ersetzen Sie dabei PROJECT_ID durch die ID des Projekts, für das Sie die API aktivieren möchten:
gcloud services list --project=PROJECT_ID
Wenn monitoring.googleapis.com in der Ausgabe angezeigt wird, ist die API aktiviert.
Wenn die API nicht aktiviert ist, führen Sie den folgenden Befehl aus, um sie zu aktivieren:
Der Zugriff auf die Monitoring API wird durch Rollen und Berechtigungen von Identity and Access Management (IAM) gesteuert.
Jeder Methode ist eine Berechtigung zugeordnet. Berechtigungen für zugehörige Methoden werden in Rollen zusammengefasst, die dann den Nutzern gewährt werden können. Weitere Informationen finden Sie unter Zugriff mit IAM steuern.
Sobald der Zugriff auf eine API autorisiert ist, kann die API von überall aus verwendet werden.
Sie können beispielsweise die Methode timeSeries.list von Ihrer lokalen Workstation aus aufrufen. Sie können die API auch verwenden, um Messwerte für jede Entität zu senden, die als überwachte Ressource dargestellt werden kann.
Eine Liste der verfügbaren Typen finden Sie unter Überwachte Ressourcentypen für benutzerdefinierte Messwerte.
In einigen Situationen können Sie möglicherweise auch API-Schlüssel verwenden. Dienstkonten werden jedoch im Allgemeinen empfohlen. API-Schlüssel sind in Clients wie Browsern und mobilen Anwendungen ohne Back-End-Server nützlich.
Weitere Informationen finden Sie unter API-Schlüssel verwenden.
Weitere Informationen zur Authentifizierung und Autorisierung finden Sie in unserem Authentifizierungsleitfaden.
[[["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)."],[],[],null,["# Enable the Monitoring API\n\nThis page describes how to enable and authorize use of the\nMonitoring API v3. You must enable this API before you can use it.\n\nEnable the Monitoring API\n-------------------------\n\nTo determine whether the Monitoring API is enabled or to enable the\nAPI, use either the Google Cloud console or the Google Cloud CLI.\n\n\n### Google Cloud console\n\n1. In the Google Cloud console, select the Google Cloud project for\n which you want to enable the API,\n and then go to the **APIs \\& Services** page:\n\n [Go to **APIs \\& Services**](https://console.cloud.google.com/apis/dashboard)\n2. Click the **Enable APIs and Service** button.\n\n3. Search for \"Monitoring\".\n\n4. In the search results, click through to \"Stackdriver Monitoring API\".\n\n5. If \"API enabled\" is displayed, then the API is already enabled. If\n not, then click **Enable**.\n\n### gcloud CLI\n\n1. If you have not already installed the Google Cloud CLI on your\n workstation, see\n [Installing the gcloud CLI](/sdk/docs/install).\n\n2. To see if the Monitoring API is enabled, run the following\n command on your workstation, after replacing \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the\n ID of the project for which you want to enable the API:\n\n gcloud services list --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n If `monitoring.googleapis.com` appears in the output, the API is\n enabled.\n3. If the API is not enabled, then run the following command to enable it:\n\n gcloud services enable monitoring --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n For more information, see\n [`gcloud services`](/sdk/gcloud/reference/services).\n\n\u003cbr /\u003e\n\nAuthorize use of the Monitoring API\n-----------------------------------\n\nAccess to the Monitoring API is controlled by\nIdentity and Access Management (IAM) roles and permissions.\nThere is a permission associated with each method, and\npermissions for related methods are clustered into roles, which can then\nbe granted to users. For more information, see\n[Control access with IAM](/monitoring/access-control).\n\nAfter access to an API is authorized, the API can be used from anywhere.\nFor example, you can call the [`timeSeries.list`](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)\nmethod from your local workstation. You can also use the API to send\nmetrics against any entity that can be represented as a monitored resource.\nSee [Monitored-resource types for user-defined metrics](/monitoring/custom-metrics#which-resource)\nfor the list of available types.\n\nIf you are writing an application that uses the\nrecommended [client libraries](/monitoring/docs/reference/libraries), these libraries\nauthorize your application by using\n[Application Default Credentials](/docs/authentication/production).\n\nYou might also be able to use API keys in some situations, but service accounts\nare generally recommended. API keys are useful in clients like\nbrowsers and mobile applications that don't have a backend server.\nFor more information, see [Using API Keys](/docs/authentication/api-keys).\n\nYou can find out more about authentication and authorization\nin our [Authentication guide](/docs/authentication/getting-started)."]]