# Correct the uptime history

Mark an outage a check error when the check was wrong and the service was up, so it stops counting against uptime while staying visible.

A check can be wrong: a path that answers `403` by design, an expired test token, a keyword that
changed. The outage it recorded is then not an outage of your service. Marking it a **check error**
keeps it, visibly: status pages draw the span hatched, list the day with your reason, leave the
span out of the uptime figure, and show a correction in their **History**. Nothing is deleted, and
the change can be undone.

Use it for checks that were wrong, never to hide a real outage: the reason is public on every
status page that shows the check.

Replace _check-id_ with the check's id and _outage-id_ with the outage's.

## Prerequisites

- Permission for `monitoring:ExcludeOutage` on the check,
  `rn:ews::<organization id>:monitoring:check/<check id>`, and `monitoring:GetCheckResults` to list
  its outages.

## Find the outage

```sh
dcloud monitoring checks outages check-id
```

Each outage has its `id`, `startedAt`, `endedAt`, `cause`, and `fromPending`: `true` when the check
had never passed when it began. Status pages already show such an outage as no data; mark it a check
error anyway when you want the page's History to say what happened. Only a closed outage can be
marked: while the check still fails, fix it first (`409` otherwise).

## Mark it a check error

**CLI**
```sh
dcloud monitoring checks exclude-outage check-id outage-id \
  --reason "The check requested /, which answers 403 by design. The service was available."
```

**API**
```http
PUT /monitoring/api/checks/check-id/outages/outage-id/exclusion
{ "reason": "The check requested /, which answers 403 by design. The service was available." }
```

The answer is the outage with `excludedAt` and `excludedReason` set. Fix the check too (see
[Change an uptime check](change-an-uptime-check.md)), or it records the same outage again.

## Undo it

```sh
dcloud monitoring checks include-outage check-id outage-id
```

## When it is refused

- `404` "Outage not found" when the outage is not one of this check's.
- `403` without `monitoring:ExcludeOutage`. The decision is recorded in the audit log either way.

## Related

- [Add components to a status page](add-components.md)
- [Read check results](read-check-results.md)
- `monitoring.checks.exclude-outage`
