alerts
Creates, updates, deletes, gets or lists an alerts resource.
Overview
| Name | alerts |
| Type | Resource |
| Id | google.monitoring.alerts |
Fields
The following fields are returned by SELECT queries:
- projects_alerts_get
- projects_alerts_list
| Name | Datatype | Description |
|---|---|---|
name | string | Identifier. The name of the alert.The format is: projects/[PROJECT_ID_OR_NUMBER]/alerts/[ALERT_ID] The [ALERT_ID] is a system-assigned unique identifier for the alert. |
closeTime | string (google-datetime) | The time when the alert was closed. |
log | object | The log information associated with the alert. This field is only populated for log-based alerts. (id: LogMetadata) |
metadata | object | The metadata of the monitored resource. (id: MonitoredResourceMetadata) |
metric | object | The metric type and any metric labels preserved from the incident's generating condition. (id: Metric) |
openTime | string (google-datetime) | The time when the alert was opened. |
policy | object | The snapshot of the alert policy that generated this alert. (id: PolicySnapshot) |
resource | object | An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "project_id", "instance_id" and "zone": { "type": "gce_instance", "labels": { "project_id": "my-project", "instance_id": "12345678901234", "zone": "us-central1-a" }} (id: MonitoredResource) |
state | string | Output only. The current state of the alert. |
| Name | Datatype | Description |
|---|---|---|
name | string | Identifier. The name of the alert.The format is: projects/[PROJECT_ID_OR_NUMBER]/alerts/[ALERT_ID] The [ALERT_ID] is a system-assigned unique identifier for the alert. |
closeTime | string (google-datetime) | The time when the alert was closed. |
log | object | The log information associated with the alert. This field is only populated for log-based alerts. (id: LogMetadata) |
metadata | object | The metadata of the monitored resource. (id: MonitoredResourceMetadata) |
metric | object | The metric type and any metric labels preserved from the incident's generating condition. (id: Metric) |
openTime | string (google-datetime) | The time when the alert was opened. |
policy | object | The snapshot of the alert policy that generated this alert. (id: PolicySnapshot) |
resource | object | An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "project_id", "instance_id" and "zone": { "type": "gce_instance", "labels": { "project_id": "my-project", "instance_id": "12345678901234", "zone": "us-central1-a" }} (id: MonitoredResource) |
state | string | Output only. The current state of the alert. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
projects_alerts_get | select | projectsId, alertsId | Gets a single alert. | |
projects_alerts_list | select | projectsId | filter, orderBy, pageSize, pageToken | Lists the existing alerts for the metrics scope of the project. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
alertsId | string | |
projectsId | string | |
filter | string | |
orderBy | string | |
pageSize | integer (int32) | |
pageToken | string |
SELECT examples
- projects_alerts_get
- projects_alerts_list
Gets a single alert.
SELECT
name,
closeTime,
log,
metadata,
metric,
openTime,
policy,
resource,
state
FROM google.monitoring.alerts
WHERE projectsId = '{{ projectsId }}' -- required
AND alertsId = '{{ alertsId }}' -- required
;
Lists the existing alerts for the metrics scope of the project.
SELECT
name,
closeTime,
log,
metadata,
metric,
openTime,
policy,
resource,
state
FROM google.monitoring.alerts
WHERE projectsId = '{{ projectsId }}' -- required
AND filter = '{{ filter }}'
AND orderBy = '{{ orderBy }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;