---
title: Monitoring Ranges
description: >-
  Create monitors that alert when metric values fall inside or outside a
  specified range using mathematical formulas with absolute values.
breadcrumbs: Docs > Monitors > Monitor Guides > Monitoring Ranges
---

# Monitoring Ranges

## Overview{% #overview %}

If a monitor supports alerting when a given value is above or below a given threshold, it is possible to be notified if a given value is inside or outside of a range.

## Examples{% #examples %}

### Metric{% #metric %}

Metric `a` reports discrete values from `0` to `10` representing a status and you want to be notified if the metric is not between `4` and `8`. Mathematically, the difference between the metric and the center of the range (6) should never be more than 2.

```
8 > a > 4 <=> abs(6-a) < 2 <=> abs(6-a) - 2 < 0
```

- To be notified if the value is outside the range, the monitor condition should be `abs(6-a) - 2 > 0`.
- To be notified if the value is inside the range, the monitor condition should be `2 - abs(6-a) > 0`.

{% image
   source="https://datadog-docs.imgix.net/images/monitors/faq/monitor_range.12410b1ca4e58f50179b2d9f88543afc.png?auto=format"
   alt="metric monitor on a range" /%}

### Theoretical{% #theoretical %}

A range is defined by `x > a > y` with `a` being the metric in question.

- To be notified if the value is outside the range, the monitor condition should be: `abs(x - (x-y)/2 - a) - (x-y)/2 > 0`.
- To be notified if the value is inside the range, the monitor condition should be: `(x-y)/2 - abs(x - (x-y)/2 - a) > 0`.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
