Use Filters to Forecast Metrics

Horizon and Meridian include several predefined filters that the OpenNMS Plugin for Grafana can use to display forecast metrics in a panel.

Adding a forecast filter can help you anticipate when you might need to make changes to your network depending on, for example, anticipated bandwidth usage, disk space capacity, network traffic, and so on. This section describes how to create forecast metrics based on network usage, using ifHCOutOctets (the number of octets sent by an interface).

Create a network usage panel

Follow these steps to create a panel that visualizes network usage:

  1. Navigate to your OpenNMS Plugin for Grafana dashboard.

  2. Click the Add Panel symbol.

  3. Click Add Query.

  4. Select a datasource from the Query list.

    You must select a Performance datasource.
  5. Choose Attribute from the Type icon.

  6. Specify the node that you want to monitor.

  7. Specify the appropriate resource ID.

  8. Under Attribute, click the Tag symbol to display a list of available attributes.

  9. Select ifHCOutOctets.

Next, create an expression to display this information in bits instead of bytes:

  1. Click Add Query.

  2. Choose Expression from the Type list.

  3. In the Expression box, type ifHCOutOctets * 8.

  4. Specify a label (for example, Out).

  5. Hide the ifHCOutOctets attribute by clicking the eye symbol beside it.

Create a forecast filter

Follow these steps to create a forecast filter for your dashboard:

  1. Click Add Query.

  2. Choose Filter from the Type list.

  3. Select HoltWinters from the Filter Type list, and click Select.

    • Note that the far-right column displays requirements for the node that is being queried (for example, R, Java).

  4. Specify the name of the attribute or expression that you want to forecast in the Input box (in this case, Out).

  5. Specify an output or continue with the default (HW).

    • The output is the prefix for the lower and upper fit (how successfully the forecast method fits to your data).

  6. Specify the number of periods to forecast, the length of the period (in seconds), and the desired probability in the appropriate boxes.

    • Note that these fields are interdependent. For example, this configuration specifies a three-hour forecast:

      Example configuration settings for a forecast.
    • Your time range must include at least more than twice the period size (in this case, 7200 seconds or more) to retrieve the historical data required for the forecast.

    • Consider the seasonality of your data when specifying a time range (for example, you may not want to include weekend network usage in a forecast of traffic during regular business hours).

    • Note that if your data is noisy or spiky, forecasting does not work as well. In these cases, you should add the Chomp and Outlier filters and rearrange them so they appear before the HoltWinters filter in the list of queries. You must specify an input for the Outlier filter.

  7. Click Save.

Display forecast data

Because the default time range for a panel returns data from the past to the present, you must create a custom time range to display forecast data:

  1. Select Custom Time Range from the Time Range list.

  2. Specify the start of your time range in the From box (for example, now-6h).

  3. Specify the end of your time range in the To box:

    Example dashboard time range configuration.

The panel displays the forecast data for the time period that you specify: image::pc-forecast.png["Example panel displaying forecast data.", 700]

You can experiment with the time range function to see how it updates your forecast results. Note that the further into the future you forecast, the less authoritative the data will be.

Filters

You can use the following predefined filters to create forecasting metrics:

Filter Description Use

Chomp

Strips leading and trailing rows that contain only NaN/null values.

Useful when the values from the data source do not cover the entire time interval that the report uses.

HoltWinters

Performs Holt-Winters forecasting.

Creates forecasts of your data based on the parameters that you specify.

Outlier

Removes data points that differ significantly from other data, and replaces them with interpolated values.

Helps to smooth data and improve forecasting results.

Trend

Fits a trend line or polynomial to a given column.

Displays upwards or downwards changes in forecast data.

JEXL

Generic JEXL expression filter.

Filters on mathematical and conditional operators that JEXL provides. For example, you could specify a filter to display the sum of certain data.

Percentile

Calculates percentiles.

Displays the percentage of data under the specified percentile.

Derivative

Calculates the derivative (rate of change) between rows.

Displays the rate of change during the forecast period.