[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[],[],null,["# Introduction to the Cloud Monitoring API\n\nThis page describes some of the features of the Cloud Monitoring API v3.\n\nFor the API reference documentation, see either of the following pages:\n\n- [Cloud Monitoring API (REST)](/monitoring/api/ref_v3/rest)\n- [Cloud Monitoring API (gRPC)](/monitoring/api/ref_v3/rpc)\n\nProject names in the Monitoring API\n-----------------------------------\n\nAll of the methods in the Monitoring API have a required `name`\nparameter. This parameter typically has a description like the following:\n\n*Required. The project on which to execute the request. The format is:\n`projects/[PROJECT_ID_OR_NUMBER]`*\nIn the Monitoring API, the value of `PROJECT_ID_OR_NUMBER` identifies one of the following:\n\n\u003cbr /\u003e\n\n- A Google Cloud project\n- A Google Cloud project that is also a [scoping project of a metrics scope](/monitoring/settings)\n\nSome methods in the Monitoring API require the project to be a\nscoping project of a metrics scope; others methods do not. A small number of\nmethods can return different results, depending on the type of project.\n\nTo describe these classes of methods, this discussion uses the term *metrics\nAPI* to refer to the following resources in the Monitoring API:\n\n- [`TimeSeries`](/monitoring/api/ref_v3/rest/v3/TimeSeries)\n- [`MetricDescriptor`](/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricDescriptor)\n- [`MonitoredResourceDescriptor`](/monitoring/api/ref_v3/rest/v3/projects.monitoredResourceDescriptors#MonitoredResourceDescriptor)\n\n### scoping project of a metrics scope required\n\nAll Monitoring API methods that are *not* part of the metrics API\nrequire the `name` parameter to refer to a scoping project of a metrics scope.\n\n### scoping project of a metrics scope not required\n\nNone of the methods in the metrics API require the `name` parameter to refer\nto a scoping project of a metrics scope, but some methods behave differently when\nit is:\n\n- The following methods in the metrics API operate on the named\n Google Cloud project. These methods affect data only in the named\n project, regardless of whether the project is also a\n scoping project of a metrics scope.\n\n - `timeSeries.create`\n - `metricDescriptors.create`\n - `metricDescriptors.delete`\n - `metricDescriptors.get`\n - `monitoredResourceDescriptors.get`\n- The remaining methods in the metrics API behave as follows:\n\n - If the named project is not a scoping project of a metrics scope, then the methods retrieve data only from the named project.\n - If the named project is also a scoping project of a metrics scope, then the methods retrieve data from both the named project and any projects it monitors.\n\n The methods in this group are the following:\n - `timeSeries.list`\n - `timeSeries.query`\n - `metricDescriptors.list`\n - `monitoredResourceDescriptors.list`\n\nFor information on setting up a Google Cloud project as a\nscoping project of a metrics scope, see\n[Metrics scopes overview](/monitoring/settings).\n\n\nAPI resources\n-------------\n\n### Metrics\n\nThe Monitoring API gives you access to approximately [6,500 Cloud Monitoring metrics](/monitoring/api/metrics) from Google Cloud and Amazon Web Services. You can create your own custom metrics and can organize your cloud resources using groups.\n\nFor an introduction to metric concepts and the data structures that represent\nthem, see [Metrics, time series, and resources](/monitoring/api/v3/metrics).\nTo learn how to manage your custom metrics and the built-in metrics, see [User-defined metrics overview](/monitoring/custom-metrics).\n\nFor a complete list of available metrics, see\n[Metrics list](/monitoring/api/metrics).\n\n### Monitored resources\n\nA **monitored resource** is something about which metrics are collected.\nFor example, you might be interested in the activity of a VM instance or\na piece of hardware.\n\nFor a list of the available monitored resources, see the\n[Monitored resource list](/monitoring/api/resources).\n\n### Monitored-resource groups\n\nA **group** is a dynamic collection of monitored resources. You have always\nbeen able to create groups manually in the Google Cloud console, and\nyou can also use the Cloud Monitoring API to write code that creates and uses\ngroups.\n\nFor more information, see the API reference for [`Group`](/monitoring/api/ref_v3/rest/v3/projects.groups#Group).\n\n\n### Alerting policies\n\nAn **alerting policy** is a configuration resource that describes the\ncriteria for generating incidents and how to notify you when those\nincidents are created. [Alerting concepts](/monitoring/alerts) explains the basic\nconcepts of alerting policies. For more information, see the API reference for\n[`AlertPolicy`](/monitoring/api/ref_v3/rest/v3/projects.alertPolicies#AlertPolicy).\n\nThe API also lets you create alerting policies based on a ratio of two metrics.\nRatios cannot currently be created by using Monitoring in\nthe Google Cloud console.\nFor more information, see [`MetricThreshold`](/monitoring/api/ref_v3/rest/v3/projects.alertPolicies#MetricThreshold) in the\n[`AlertPolicy` reference](/monitoring/api/ref_v3/rest/v3/projects.alertPolicies#AlertPolicy).\n\n### Notification channels\n\n|\n| **Beta**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nA **notification channel** is a configuration resource that describes how\nto notify you when incidents occur. Notification channels can reference a\nvariety of different kinds of communication services and endpoints; these\nare specified in *descriptors*. The descriptors determine the\nset of configuration parameters that are included in a channel object.\n\nFor more information, see the\n[`NotificationChannel` reference](/monitoring/api/ref_v3/rest/v3/projects.notificationChannels) and the\n[`NotificationChannelDescriptor` reference](/monitoring/api/ref_v3/rest/v3/projects.notificationChannelDescriptors).\n\n### Service monitoring\n\nThe **service monitoring** resources are used to set up service-level\nobjectives that can be used to monitor the health of your services.\n\nService Monitoring adds the following resources to the Monitoring API:\n\n- [`services`](/monitoring/api/ref_v3/rest/v3/services)\n- [`services.serviceLevelObjectives`](/monitoring/api/ref_v3/rest/v3/services.serviceLevelObjectives)\n\nFor more information about these service-monitoring concepts and about using\nthe API, see [SLO monitoring](/stackdriver/docs/solutions/slo-monitoring).\n\n\n### Dashboards\n\nYou can programmatically create and manipulate both dashboards and charts\nusing the [`Dashboards`](/monitoring/api/ref_v3/rest/v1/projects.dashboards) endpoint. For information on using\nthis endpoint to manage dashboards and charts, see\n[Managing dashboards by API](/monitoring/dashboards/api-dashboard).\n\n\n### Monitoring Query Language\n\n| **Announcement:** Starting on October 22, 2024, Monitoring Query Language (MQL) will no longer be a recommended query language for Cloud Monitoring. Certain usability features will be disabled, but you can still run MQL queries in Metrics Explorer, and dashboards and alerting policies that use MQL will continue to work. For more information, see the [deprecation notice for\n| MQL](/stackdriver/docs/deprecations/mql).\n\nMonitoring Query Language (MQL) provides a text-based interface for querying\nCloud Monitoring time-series data. MQL uses a piped-query\nmodel and is more expressive than Monitoring filters.\nYou can use MQL queries from the Monitoring API or\nfrom the code editor.\n\nFor general information on MQL, see [Using Monitoring Query Language](/monitoring/mql).\n\nFor information on using MQL to retrieve time-series data by using\nthe Monitoring API, see the API reference for the\n[`timeSeries.query`](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/query) method.\n\n\nFilters\n-------\n\nThe Monitoring API uses filters to select metrics, to fetch time-series data, and to collect monitored resources into groups. For more information, see [Monitoring filters](/monitoring/api/v3/filters).\n\nThe Monitoring API also uses filters to restrict the result set of\ncertain `list` operations. See\n[Sorting and filtering](/monitoring/api/v3/sorting-and-filtering) for details\non managing the results of the [`alertPolicies.list`](/monitoring/api/ref_v3/rest/v3/projects.alertPolicies/list)\nand [`notificationChannels.list`](/monitoring/api/ref_v3/rest/v3/projects.notificationChannels/list) methods.\n\n\nNext steps\n----------\n\n- See the introduction to [Metrics, time series, and resources](/monitoring/api/v3/metrics).\n- See the introduction to [Using alerting policies](/monitoring/alerts).\n- See how to call API methods from the [APIs Explorer](/monitoring/api/apis-explorer).\n- See how to use the text-based [Monitoring Query Language](/monitoring/mql) for querying time-series data.\n- See the [client libraries for Cloud Monitoring](/monitoring/docs/reference/libraries)\n to get started with Cloud Monitoring in your language of choice.\n\n- See the API reference, [Cloud Monitoring API (REST)](/monitoring/api/ref_v3/rest)\n or [Cloud Monitoring API (gRPC)](/monitoring/api/ref_v3/rpc)."]]