---
title: Forecasts Monitor
description: >-
  Predict future metric trends using linear and seasonal algorithms to alert
  before issues occur, such as disk space running out.
breadcrumbs: Docs > Monitors > Monitor Types > Forecasts Monitor
---

# Forecasts Monitor

## Overview{% #overview %}

Forecasting is an algorithmic feature that allows you to predict where a metric is heading in the future. It is well-suited for metrics with strong trends or recurring patterns. For example, if your application starts logging at a faster rate, forecasts can alert you a week before a disk fills up, giving you adequate time to update your log rotation policy. Or, you can forecast business metrics, such as user sign-ups, to track progress against your quarterly targets.

## Monitor creation{% #monitor-creation %}

To create a [forecast monitor](https://app.datadoghq.com/monitors/create/forecast) in Datadog, use the main navigation: *Monitors –> New Monitor –> Forecast*.

### Define the metric{% #define-the-metric %}

Any metric currently reporting to Datadog is available for monitors. For more information, see the [Metric Monitor](https://docs.datadoghq.com/monitors/types/metric/#define-the-metric) page.

After defining the metric, the forecast monitor provides two preview graphs in the editor:

{% image
   source="https://datadog-docs.imgix.net/images/monitors/monitor_types/forecasts/editor_graphs.a1d1c9df005a088af151dc64cca20978.png?auto=format"
   alt="Editor graphs" /%}



- The **Historical View** lets you explore the past metric data at different time scales.
- The **Evaluation Preview** shows a combination of historical and predicted metric data.

### Set alert conditions{% #set-alert-conditions %}

- Trigger an alert when the edge of the forecast confidence bounds goes `above` or `below`.
- the threshold within the next `24 hours`, `1 week`, `1 month`, etc. or `custom` to set a value between 12 hours and 3 months.
- Alert threshold: >= `<NUMBER>`
- Warning threshold: >= `<NUMBER>`
- Alert [recovery threshold](https://docs.datadoghq.com/monitors/guide/recovery-thresholds/): < `<NUMBER>`
- Warning [recovery threshold](https://docs.datadoghq.com/monitors/guide/recovery-thresholds/): < `<NUMBER>`

#### Advanced options{% #advanced-options %}

Datadog automatically analyzes your chosen metric and sets several parameters for you. However, the options are available to edit under **Advanced Options**:

{% image
   source="https://datadog-docs.imgix.net/images/monitors/monitor_types/forecasts/advanced_options.a246e9580498e15d9247b001212857fd.png?auto=format"
   alt="Advanced options" /%}

| Option                                                                                                     | Description                                                                                                       |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| Algorithm                                                                                                  | The forecast algorithm (`linear` or `seasonal`)                                                                   |
| Model                                                                                                      | The forecast model (`default`, `simple`, or `reactive`) for the linear algorithm                                  |
| Seasonality                                                                                                | The forecast seasonality (`hourly`, `daily`, or `weekly`) for the seasonal algorithm                              |
| [Daylight savings](https://docs.datadoghq.com/monitors/guide/how-to-update-anomaly-monitor-timezone/) | Available for `seasonal` forecast monitors with `daily` or `weekly` seasonality.                                  |
| [Rollup](https://docs.datadoghq.com/dashboards/functions/rollup/)                                          | The rollup interval—larger intervals between points avoid noise influence on the forecast.                        |
| Deviations                                                                                                 | The width of the range of forecasted values—a value of 1 or 2 is generally large enough for most "normal" points. |

##### Algorithms{% #algorithms %}

The available forecast algorithms are `linear` and `seasonal`:

{% tab title="Linear" %}
Use the linear algorithm for metrics that have steady trends but no repeating seasonal pattern. There are three different *models* which control the linear algorithm's sensitivity to level shifts:

| Model    | Description                                                                                |
| -------- | ------------------------------------------------------------------------------------------ |
| Default  | Adjusts to the most recent trend and extrapolates data while being robust to recent noise. |
| Simple   | Does a robust linear regression through the entire history.                                |
| Reactive | Extrapolates recent behavior better at the risk of overfitting to noise, spikes, or dips.  |

{% image
   source="https://datadog-docs.imgix.net/images/monitors/monitor_types/forecasts/linear_default.e98ad813b9be79870377107eea67d992.png?auto=format"
   alt="linear default" /%}

{% image
   source="https://datadog-docs.imgix.net/images/monitors/monitor_types/forecasts/linear_simple.689d912a331c8bf667a84c225216e9e3.png?auto=format"
   alt="linear simple" /%}

{% image
   source="https://datadog-docs.imgix.net/images/monitors/monitor_types/forecasts/linear_reactive.3b14e6bb2dc78af4468b3e4e55baed5f.png?auto=format"
   alt="linear reactive" /%}

{% /tab %}

{% tab title="Seasonal" %}
Use the seasonal algorithm for metrics with repeating patterns. There are three different *seasonality* choices:

| Option | Description                                                                                                                                   |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Hourly | The algorithm expects the same minute after the hour behaves like past minutes after the hour, for example 5:15 behaves like 4:15, 3:15, etc. |
| Daily  | The algorithm expects the same time today behaves like past days, for example 5pm today behaves like 5pm yesterday.                           |
| Weekly | The algorithm expects that a given day of the week behaves like past days of the week, for example this Tuesday behaves like past Tuesdays.   |

**Note**: This algorithm requires at least two seasons of history and uses up to six seasons for forecasting.

{% image
   source="https://datadog-docs.imgix.net/images/monitors/monitor_types/forecasts/seasonal.697544e9f5c8149240f1601d49fb2774.png?auto=format"
   alt="seasonal" /%}

{% /tab %}

### Advanced alert conditions{% #advanced-alert-conditions %}

For detailed instructions on the advanced alert options (no data, evaluation delay, etc.), see the [Monitor configuration](https://docs.datadoghq.com/monitors/configuration/#advanced-alert-conditions) page. For the metric-specific option full data window, see the [Metric monitor](https://docs.datadoghq.com/monitors/types/metric/#data-window) page.

### Notifications{% #notifications %}

For detailed instructions on the **Configure notifications and automations** section, see the [Notifications](https://docs.datadoghq.com/monitors/notify/) page.

## API{% #api %}

To create forecast monitors programmatically, see the [Datadog API reference](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor). Datadog **strongly recommends** [exporting a monitor's JSON](https://docs.datadoghq.com/monitors/status/#settings) to build the query for the API. By using the [monitor creation page](https://app.datadoghq.com/monitors/create/forecast) in Datadog, customers benefit from the preview graph and automatic parameter tuning to help avoid a poorly configured monitor.

Forecast monitors are managed using the [same API](https://docs.datadoghq.com/api/v1/monitors/) as other monitors, but the contents of the `query` property deserves further explanation.

The `query` property in the request body should contain a query string in the following format:

```text
<aggregator>(<query_window>):forecast(<metric_query>, '<algorithm>', <deviations>, interval=<interval>[, history='<history>'][, model='<model>'][, seasonality='<seasonality>']) <comparator> <threshold>
```

- `aggregator`: Use `min` if the alert should trigger when the forecast goes below the threshold. Use `max` if the alert should trigger when the forecast goes above the threshold.
- `query_window`: A timeframe, for example: `next_4h` or `next_7d`.
- `metric_query`: A standard Datadog metric query, for example: `min:system.disk.free{service:database,device:/data}by{host}`.
- `algorithm`: `linear` or `seasonal`
- `deviations`: A number greater than or equal to one. This parameter controls the size of the confidence bounds, allowing a monitor to be made more or less sensitive.
- `interval`: A positive integer representing the number of seconds in the rollup interval.
- `history`: A string representing the amount of past data that should be used for making the forecast, for example: `1w`, `3d`. This parameter is only used with the `linear` algorithm.
- `model`: The type of model to use: `default`, `simple`, or `reactive`. This parameter is only used with the `linear` algorithm.
- `seasonality`: The seasonality to use: `hourly`, `daily`, or `weekly`. This parameter is only used with the `seasonal` algorithm
- `comparator`: Use `<=` to alert when the forecast goes below the threshold. Use `>=` to alert when the forecast goes above the threshold.
- `threshold`: A critical alert will trigger when the forecast's confidence bounds reach this threshold.

## Troubleshooting{% #troubleshooting %}

The following functions cannot be nested inside calls to the `forecast()` function:`anomalies`, `cumsum`, `integral`, `outliers`, `piecewise_constant`, `robust_trend`, or `trend_line`

## Further Reading{% #further-reading %}

- [Manage and optimize your OCI costs with Datadog Cloud Cost Management](https://www.datadoghq.com/blog/cloud-cost-management-oci)
- [Configure your monitor notifications](https://docs.datadoghq.com/monitors/notify/)
- [Schedule downtime to mute a monitor](https://docs.datadoghq.com/monitors/downtimes/)
- [Consult your monitor status](https://docs.datadoghq.com/monitors/status/)
