# Google Cloud Monitoring

EvoHub receives Google Cloud Monitoring incidents through a **Webhooks** notification channel. An incident opening creates an EvoHub alert, and the incident closing resolves it.

## Set it up

:::steps
### Create the integration
In EvoHub, go to **On-Call → Integrations → + Add Integration**, choose **Google Cloud**, pick an **Escalation Policy** and click **Create Integration**. Copy the **Webhook URL**.
### Add a webhook channel
In Google Cloud, go to **Monitoring → Alerting → Edit notification channels → Webhooks → Add new** and set **Endpoint URL** to your webhook URL.

```text
https://evohub.io/ingest/googlecloud?key=YOUR_INTEGRATION_KEY
```
### Use it in alerting policies
Select the channel in the alerting policies that should page, and turn on the policy's option to notify when the incident closes.
:::

## Turn on auto-resolve

By default, Cloud Monitoring notifies only when an incident opens. In each alerting policy, turn on the option to notify on closure (shown as **Notify on incident closure** or **Notify on alert closure**, depending on the console version). Cloud Monitoring then notifies the channel with the incident's `state` set to `closed`, and EvoHub resolves the matching alert. Without it, alerts stay open until someone resolves them in EvoHub.

## What EvoHub reads

EvoHub reads the `incident` object of the notification:

| EvoHub alert | Taken from |
| --- | --- |
| Title | `policy_name`, else `condition_name`, else "Google Cloud Alert". |
| Description | `summary`. |
| Labels | `policy` and `condition`. |
| Link | `url`, the incident in the Cloud console. It opens from the alert. |
| Values and notes | `observed_value`, `threshold_value`, and the policy's documentation (`documentation`) — often its runbook. |
| Fingerprint | `incident_id`. |

### Severity

Severity comes from the severity level set on the alerting policy:

| Policy severity | EvoHub severity |
| --- | --- |
| CRITICAL | critical |
| ERROR | high |
| WARNING | medium |
| none set, or anything else | info |

A policy without a severity level opens **info** alerts. Set a severity on policies that should wake someone up.

## Resolve and deduplication

- `state: closed` resolves the open alert with the same `incident_id`. Any other state opens an alert.
- Another notification for the same incident while its alert is open is recorded as **Retriggered**. A new incident from the same policy has a new ID and opens a new alert.

## Troubleshooting

- **`401 INVALID_KEY`**: the URL's key is wrong or the integration is disabled. Copy the **Webhook URL** again from the integration.
- **Alerts arrive as info**: the alerting policy has no severity level. Set one in the policy.
- **Nothing arrives**: check that the channel is selected in the policy's notifications.
- **Alerts never resolve**: the policy does not notify on incident closure. Turn that option on in the policy's notifications.

## Related

- [Integrations overview](https://docs.evohub.io/integrations-overview.md)
- [Azure Monitor](https://docs.evohub.io/azure-monitor.md)
- [Escalation policies](https://docs.evohub.io/escalation-policies.md)
