Holt-Winters functionality (forecasting) with Cacti
Moderators: Developers, Moderators
Holt-Winters functionality (forecasting) with Cacti
When will Holt-Winters forecast be implemented in cacti?
I've had some success in getting some Holt-Winters functionality into Cacti.sveioen wrote:When will Holt-Winters forecast be implemented in cacti?
All you need to do is:
(a) Convert your RRA files to have the HWPREDICT etc... functions. This is easy with a perl tool called rrd_hwreapply, which you can find as part of the rrdman toolkit on sourceforge http://rrfw.sourceforge.net/rrdman
(b) Edit include/config_arrays.php - where the consolidation_functions array is defined. Add the following to the array - HWPREDICT, SEASONAL, DEVPREDICT, DEVSEASONAL, FAILURES
Now from the Brutlag document you just need to create some CDEFs to use these variables.
- Attachments
-
- holt-winters.patch
- Patch for include/config_arrays.php
- (423 Bytes) Downloaded 765 times
Last edited by gilesc on Fri Feb 22, 2008 5:02 am, edited 1 time in total.
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Hi
I've created a new topic because IMHO a lot of people - including me - are interested in forecasting with Cacti...
I've created a new topic because IMHO a lot of people - including me - are interested in forecasting with Cacti...
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
Confidence Bands
OK, Well - I'm getting only so so far with this... I seem to have a reasonable HWPREDICT value, but I do have some problems with my CDEF for confidence bands - perhaps I'm being stupid with RPN... It is a bit messy, but I'm just trying to get something to work... here is my graph:
My SNMP values are in bytes and I want bits.
My understanding is that if I take HWPREDICT, I can get two confidence bands by plotting HWPREDICT + (2*DEVPREDICT) and HWPREDICT - (2*DEVPREDICT)
The problem I have with the above graph is that the Confidence bands do not appear to be equidistant from the HWPREDICT graph, and in some places the confidence bands actually cross the HWPREDICT graph.
I've tried the following RPN notations for CDEFs to calculate the confidence bands - (CDS = Current Datasource))
CDS,d,2,*,+,8,* & CDS,d,-2,*,+,8,*
CDS,8,*,d,16,*,+ & CDS,8,*,d,-16,*,+
am I doing something (RPN) stupid, or is there a deeper problem here?
Code: Select all
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Holt-Winters Testing - Giles" \
--base=1000 \
--height=350 \
--width=700 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/sites/stats/web/rra/bst_snmp_oid_2577.rrd":snmp_oid:AVERAGE \
DEF:b="/var/www/sites/stats/web/rra/bst_snmp_oid_2578.rrd":snmp_oid:AVERAGE \
DEF:c="/var/www/sites/stats/web/rra/bst_snmp_oid_2577.rrd":snmp_oid:HWPREDICT \
DEF:d="/var/www/sites/stats/web/rra/bst_snmp_oid_2577.rrd":snmp_oid:DEVPREDICT \
CDEF:cdefa=a,8,* \
CDEF:cdefe=b,8,* \
CDEF:cdefi=d,2,*,c,+,8,* \
CDEF:cdefj=d,-2,*,c,+,8,* \
CDEF:cdefbb=d,8,* \
CDEF:cdefbc=c,8,* \
AREA:cdefa#00CF00:"Inbound" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefe#4444FF:"Outbound" \
GPRINT:cdefe:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefi#FF0000:"Confidence Bands (Testing)\n" \
LINE1:cdefj#FF0000:"" \
LINE1:d:"" \
LINE1:cdefbb#000000:"Predicted Value" \
GPRINT:cdefbc:HWPREDICT:" %8.2lf %s\n" \
GPRINT:cdefbb:DEVPREDICT:"Deviation\:%8.2lf %s"
My understanding is that if I take HWPREDICT, I can get two confidence bands by plotting HWPREDICT + (2*DEVPREDICT) and HWPREDICT - (2*DEVPREDICT)
The problem I have with the above graph is that the Confidence bands do not appear to be equidistant from the HWPREDICT graph, and in some places the confidence bands actually cross the HWPREDICT graph.
I've tried the following RPN notations for CDEFs to calculate the confidence bands - (CDS = Current Datasource))
CDS,d,2,*,+,8,* & CDS,d,-2,*,+,8,*
CDS,8,*,d,16,*,+ & CDS,8,*,d,-16,*,+
am I doing something (RPN) stupid, or is there a deeper problem here?
Ignore me, the line:
Was plotting DEVPREDICT, not HWPREDICT...
So far it appears to work a treat, now all we need is TICK support to be able to highlight anomallies.
Code: Select all
LINE1:cdefbb#000000:"Predicted Value" \
So far it appears to work a treat, now all we need is TICK support to be able to highlight anomallies.
Attached example - the RRD that I'm using is one with only recent data and isn't as predictable as say our backbone traffic would be, but I didn't want to test on one of our more important RRD files as the process involves the insertion of the Holt-Winters RRAs in the RRD.
But as you can see, Holt-Winters in Cacti isn't all that hard after all.
But as you can see, Holt-Winters in Cacti isn't all that hard after all.
- Attachments
-
- Example of holt-winters showing the anomalies and smoothing over time.
- Clipboard02.png (57.32 KiB) Viewed 23461 times
Last edited by gilesc on Mon Feb 25, 2008 9:40 am, edited 1 time in total.
Hello gilesc,
I havent checked the forums in a while so thats why I havent replied until now. Thats really awesome that you have found a way to make it work! I have tried rrd_hwreapply and experimenting with it on RRD-files, but I never played with it within Cacti.
The screenshot you posted; do you get HW-values for all your data-history? One of the problems I couldnt figure out was that I only got predicted values from "Now - 2 hours", if you know what I mean? It was like a tail that constantly moved along with the time axis, so I never had previous predicted values for more then 2 hours back.
Anyway, I'm going to try this as soon as I can!
I havent checked the forums in a while so thats why I havent replied until now. Thats really awesome that you have found a way to make it work! I have tried rrd_hwreapply and experimenting with it on RRD-files, but I never played with it within Cacti.
The screenshot you posted; do you get HW-values for all your data-history? One of the problems I couldnt figure out was that I only got predicted values from "Now - 2 hours", if you know what I mean? It was like a tail that constantly moved along with the time axis, so I never had previous predicted values for more then 2 hours back.
Anyway, I'm going to try this as soon as I can!
This depends on your season, I had my season for this graph set to 288 - so I missed the first 24 hours due to lack of data to make the prediction, but get subsequent predictions.sveioen wrote: The screenshot you posted; do you get HW-values for all your data-history? One of the problems I couldnt figure out was that I only got predicted values from "Now - 2 hours", if you know what I mean? It was like a tail that constantly moved along with the time axis, so I never had previous predicted values for more then 2 hours back.
I've now modified two more RRD files with a weekly season (2016) of Holt Winters, and hope to start seeing predictions on them from next Friday. It's going to be a bit of a wait, but rrdtool dumps show that information is being logged. We shall see when that happens, I'll post information as these graphs have much more predictable trends in them.
Do check your RRAs in your RRDs before you use the tool to add the Holt-Winders RRAs.cwahlin wrote:This looks interesting. I'll have to convert one of my rrds and do some testing myself. Hopefully I can get started tonight
/Carl
I have found that if you have RRAs in a strange order in your RRD file that you may lose some historical information, might be best to create a new data source for testing.
Any nice new graphs you want to show us?gilesc wrote:This depends on your season, I had my season for this graph set to 288 - so I missed the first 24 hours due to lack of data to make the prediction, but get subsequent predictions.sveioen wrote: The screenshot you posted; do you get HW-values for all your data-history? One of the problems I couldnt figure out was that I only got predicted values from "Now - 2 hours", if you know what I mean? It was like a tail that constantly moved along with the time axis, so I never had previous predicted values for more then 2 hours back.
I've now modified two more RRD files with a weekly season (2016) of Holt Winters, and hope to start seeing predictions on them from next Friday. It's going to be a bit of a wait, but rrdtool dumps show that information is being logged. We shall see when that happens, I'll post information as these graphs have much more predictable trends in them.
I created some new bandwidth sources earlier today to use for testing. I am reading through the brutlag doc now (is this the one you refer to earlier?).gilesc wrote:Do check your RRAs in your RRDs before you use the tool to add the Holt-Winders RRAs.cwahlin wrote:This looks interesting. I'll have to convert one of my rrds and do some testing myself. Hopefully I can get started tonight
/Carl
I have found that if you have RRAs in a strange order in your RRD file that you may lose some historical information, might be best to create a new data source for testing.
Need to put the kids to sleep before I start playing around
/Carl
More than likely not needed, if it's in the patch it's just a context reference (i.e. doesn't have a + or - at the beginning of the line)cwahlin wrote:I am using 0.8.7b which does not have config_arrays.php. It uses global_arrays.php. I added HWPREDICT etc to the array, but I see in your patch you have added " do_hook("config_arrays"); " somewhere? Where does this go? (if it is needed)
/Carl
Who is online
Users browsing this forum: No registered users and 1 guest