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:
-
Navigate to your OpenNMS Plugin for Grafana dashboard.
-
Click the Add Panel symbol.
-
Click Add Query.
-
Select a datasource from the Query list.
You must select a Performance datasource. -
Choose Attribute from the Type icon.
-
Specify the node that you want to monitor.
-
Specify the appropriate resource ID.
-
Under Attribute, click the Tag symbol to display a list of available attributes.
-
Select
ifHCOutOctets
.
Next, create an expression to display this information in bits instead of bytes:
-
Click Add Query.
-
Choose Expression from the Type list.
-
In the Expression box, type
ifHCOutOctets * 8
. -
Specify a label (for example,
Out
). -
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:
-
Click Add Query.
-
Choose Filter from the Type list.
-
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).
-
-
Specify the name of the attribute or expression that you want to forecast in the Input box (in this case,
Out
). -
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).
-
-
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:
-
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
andOutlier
filters and rearrange them so they appear before theHoltWinters
filter in the list of queries. You must specify an input for theOutlier
filter.
-
-
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:
-
Select Custom Time Range from the Time Range list.
-
Specify the start of your time range in the From box (for example,
now-6h
). -
Specify the end of your time range in the To box:
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 |
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. |