How it works
Three components take part: the Integrator stores each check in InfluxDB, the prediction service learns each monitor’s behaviour from that history, and the Webserver asks for forecasts, turns them into a predicted status and decides when to alert.
The components
| Component | Role |
|---|---|
| Probe | Runs the monitor, as usual. Holds the monitor definition, including its Enable prediction switch. |
| Integrator | Writes every check result to InfluxDB (measurement <type>ResponseTime, tag name = <type>_<monitor key>). Delivers predictive alerts. |
| InfluxDB | The history the models learn from. Version 2 (Flux) or 3 (SQL). |
| Prediction service | Trains one model per monitor and probe, and answers forecasts. Reads InfluxDB with its own credentials. |
| Webserver | Finds the monitors with prediction enabled, asks for forecasts on their schedule, decides the predicted status, orders training, sends alerts, shows the results. |
Probe ──check──▶ Integrator ──▶ InfluxDB ◀──reads── Prediction service
▲ ▲
│ predictive alerts │ signed HTTPS (forecast, train)
└──────────────── Webserver ────────┘
A forecast, step by step
- The Webserver reads the monitor definitions on each probe and keeps those with prediction enabled (refreshed every 10 minutes, or at once with Run predictions now).
- On the monitor’s own schedule (a 1-minute monitor every minute), it asks the service for a forecast of that monitor.
- The service reads the latest checks of that monitor from InfluxDB, leaving out failed checks (
ERROR,TIMEOUT,UNKNOWN,CONFIG,DOWNTIME): a timeout says nothing about response time. - The model forecasts the next checks: 5 by default, or the monitor’s own prediction count.
- The service also answers the breach risk: for each of the monitor’s thresholds, the probability that one of those next checks reaches it. The highest level whose risk passes the monitor’s own cut is the predicted status (
OK,MINOR,MAJORorCRITICAL). Where the monitor’s history does not announce its breaches, there is no predicted status and no forecast alert: see Breach risk. - The service also scores the latest check: it compares it with what the model expected for it, from the checks before it. Three standard deviations or more of the model’s usual error is an anomaly.
The result is stored and shown in the Forecasts table. The monitor’s own status, its events, reports and SLA are never changed by a forecast.
The model
Each monitor on each probe has its own model, because a monitor behaves differently from every location.
| Item | Value |
|---|---|
| Forecast | The median of the last 60 checks, for each of the next checks. A single slow check barely moves it. |
| Anomaly | The latest check against the median of the 60 checks before it, compared with the usual size of that gap for this monitor |
| Breach risk | The probability that one of the next checks reaches each threshold, learned from this monitor’s own history (see Breach risk) |
| Training | Measures that usual gap on up to 2,000 recent checks. Takes seconds and needs at least 90 successful checks. |
| Training data | Up to 280 days of history, failed checks left out |
| Quality | Each model records its mean one-step error (column Trained in the Forecasts table) |
Why a median and not a neural network
Earlier versions used a neural network (convolution + LSTM layers). It was compared with simple statistical forecasts on the real response-time history of monitors of every type (API, URL, DB, DNS, ping, TCP, WebSocket):
| Model | Error over the next 5 checks (1 = repeat the last check) | Training time per monitor |
|---|---|---|
| Median of the last 60 checks | 0.75 | about a second |
| Exponential smoothing | 0.84 | about a second |
| Neural network (LSTM) | 1.05 | about 11 minutes |
On these monitors the neural network was never more accurate than the median. On a wider set of 65 monitors, the median beat repeating the last check on 98 % of them (error 0.73), and detected 94 % of abnormal spikes for 2.8 % false alarms.
Response times are mostly noise around a level that changes now and then: there is little pattern for a neural network to learn, and the median is the forecast that reacts least to noise.
The neural network is still available: set PREDICTION_ENGINE=lstm on the prediction service (see Configuration). Each model keeps the engine it was trained with until it is retrained. An LSTM model has no breach risk: its predicted status compares the forecast values with the thresholds.
Breach risk
A flat forecast hardly ever crosses a threshold before the checks themselves do. On real history, comparing the forecast values with the thresholds warned of about 1 % of breaches before they started. So the predicted status comes from a breach risk instead.
At training, the service goes over the monitor’s history at every moment the monitor was still under its lowest threshold, and learns how the chance of a breach within the next checks depends on:
- where the recent median and the last check stand against the threshold,
- the highest of the last 5 checks,
- how often the threshold was reached over the last 60 and 600 checks,
- how much the checks vary.
It then replays this on the most recent 30 % of the history, which it did not learn from, and keeps forecast alerts on only if, there:
| Condition | Setting on the service |
|---|---|
| At least 10 breaches started, so that warnings can be judged | |
| The risk ranked the breaches at least 2 times better than chance | PREDICTION_RISK_MIN_LIFT |
| At some risk level, at least half of the warnings were right | PREDICTION_RISK_MIN_PRECISION |
That risk level becomes the monitor’s cut: a level is forecast when the risk of reaching it passes the cut. The Forecasts table shows the risk; hover it to see how often warnings were right on this monitor’s history.
What to expect
Measured on the 65 monitors of the benchmark, each with its threshold at its own 95th percentile, on history kept apart from training:
| Forecast values vs thresholds (before) | Breach risk | |
|---|---|---|
| Monitors with forecast alerts | all | 14 of 65 |
| Warnings that were right | 25 % | 55 % |
| Breaches warned of before they started, on those 14 monitors | 2 % | 30 % |
On the other monitors, breaches came without warning signs in the response times: a sudden outage, a dependency, the network. Forecast alerts stay off for them and the Forecasts table says why; anomaly detection, which reacts to the check itself, still works.
A forecast breach is a risk, not a certainty: about one warning in two is followed by a breach within the forecast horizon.
| Under the forecast, the Forecasts table shows | Meaning |
|---|---|
| No forecast alert: no threshold set | No minor / major / critical threshold is set. |
| No forecast alert: not enough history yet | Fewer than about 1,000 successful checks. |
| No forecast alert: too few past breaches | Fewer than 10 breaches in the part of the history used to judge. |
| No forecast alert: breaches come without warning | The risk ranked breaches less than 2 times better than chance. |
| No forecast alert: warnings too often wrong | No risk level gave right warnings at least half of the time. |
| Forecast alerts paused: retraining | The thresholds or the prediction count changed since training. The model retrains in seconds. |
Training
Nothing needs to be run by hand. The Webserver asks the service to train:
| When | Why |
|---|---|
| A monitor with prediction enabled has no model | First training. Asked at once, then again at most every hour until it succeeds. |
| A training failed | Retried after 24 hours (for example a new monitor with too little history). |
| A model is older than the retrain period | Every week by default: the monitor’s behaviour changes over time. |
| The monitor’s thresholds or prediction count changed | The breach risk was judged for the old ones. Asked at the next forecast; takes seconds. |
| You click Train now | Immediately, whatever the schedule. |
The service trains one model at a time, in a separate process, and replaces a model only when the new one is complete: forecasts continue with the old model meanwhile. The previous model is kept in the service’s previous folder.
With Manual training only, the Webserver never asks for training on its own; use Train now.
Predictive alerts
When Send predictive alerts is on, the Webserver watches each monitor’s predicted status and anomaly flag:
- An alert is sent when a new state is seen on two consecutive forecasts. One noisy forecast alerts no one.
- A recovery is sent when the state goes back to OK, under the same rule.
- Forecast alerts and anomaly alerts are tracked separately. Alert on chooses which ones are sent, and each monitor’s Forecast alerts setting (tab Prediction of the monitor) can override it for forecast alerts (see Configuration).
- Forecast alerts are only sent for monitors whose breach risk proved reliable on their history. The message gives the risk and how often such warnings were right on that monitor. When a monitor’s forecast alerts pause (thresholds changed), an open forecast alert is withdrawn.
- Alerts use the monitor’s on status change channels (email, Slack, Teams, PagerDuty, script), delivered by the Integrators. A monitor with no such channel gets no predictive alert.
- They are clearly marked: the monitor is named
<monitor> (forecast), and the message starts with Forecast: or Anomaly:. They have their own PagerDuty incident, separate from the monitor’s. - The Integrator only notifies: a predictive alert never reaches InfluxDB, the ITSM connectors or the Events page.
Security
| Concern | How it is handled |
|---|---|
| Who may call the service | Each request carries a token signed by the Webserver, valid 5 minutes. The service holds only the public key. The signing key is used for nothing else: it cannot open a Webserver session. |
| Talking to the right service | The service’s certificate is pinned by its SHA-256 fingerprint, or must be trusted by the Webserver host. |
| InfluxDB credentials | Only on the prediction service. The Webserver never sends any. |
| What the service may query | Only the monitor series it is named, with a query it builds itself. It cannot be used to query anything else. |
High availability
In a Webserver cluster, only the active Webserver runs predictions, training requests and alerts. The signing key is shared by all nodes, so a failover needs no change on the prediction service.