Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Jul 28, 2017 12:22 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Holt-Winters plugin - plots
PostPosted: Tue Feb 21, 2012 10:06 am 
Offline

Joined: Tue Feb 08, 2011 4:11 pm
Posts: 4
Hi,

I have implemented HWdEtect plugin to NfSen based on Holt-Winters method, using RRD database. But I have an issue to solve.

See the image...

You can see yellow areas which means that the plugin discovered some kind of anomaly behavior. It should be displayed only if the measured (green) area is lower or higher than confidence band (red). But in several cases it is colored by yellow even if it is not out of the bands. I looked into the .rrd file and in RRA FAILURES it is signed as a failure (value 1).

So I think, I have something wrong in displaying confidence bands (red).

In my code I do this:
Code:
RRDs::graph "$BACKEND_PLUGINDIR/hwdetect/plots/hwdetect-$profile-$rrd_var-$channel-00.png",
                "--title", "HWdEtect $rrd_var prediction",
                "--start", "$start - 86400",
                "--end", "$start",
                "--lower-limit=0",
                "--rigid",
                "--width=600",
                "--height=200",
                "--alt-autoscale-max",
                "--imgformat","PNG",
                "DEF:obs=$rrds[0]:$rrd_var:AVERAGE",
                "DEF:pred=$rrds[0]:$rrd_var:HWPREDICT",
                "DEF:dev=$rrds[0]:$rrd_var:DEVPREDICT",
                "DEF:fail=$rrds[0]:$rrd_var:FAILURES",
                "TICK:fail#ffffa0:1.0:\"Failures\"",
                "AREA:obs#00ff00:\"Measured count of $rrd_var\"",
                "LINE2:pred#0000ff:\"HW Prediction\"",
                "CDEF:upper=pred,dev,$deltapos[0],*,+",
                "CDEF:lower=pred,dev,$deltanegs[0],*,-",
                "LINE1:upper#ff0000:\"Upper Confidence Bound\"",
                "LINE1:lower#ff0000:\"Lower Confidence Bound\""
            ;


The important part is probably:
Code:
"CDEF:upper=pred,dev,$deltapos[0],*,+",
"CDEF:lower=pred,dev,$deltanegs[0],*,-",
"LINE1:upper#ff0000:\"Upper Confidence Bound\"",
"LINE1:lower#ff0000:\"Lower Confidence Bound\""


The variable $deltapos[0] saves the current value of delta parameter for Holt-Winters method.

Is it right? Is there a bug in rrdtool or should I use different value of delta in the plot creation?

Thanks in advise. If necessary I could post additional information/code...


Attachments:
File comment: Flows
hwdetect-peak.png
hwdetect-peak.png [ 53.79 KiB | Viewed 3314 times ]
Top
 Profile  
 
 Post subject: Re: Holt-Winters plugin - plots
PostPosted: Wed Feb 22, 2012 5:31 am 
Offline
Cacti Guru User

Joined: Thu Aug 05, 2010 2:04 am
Posts: 1573
Location: Japan
Though I'm not sure about it,
is the "RRA:FAILURES" defined correctly? (Is threshold specified properly?)

Otherwise, try using custom CDEF to judge whether if measured count (=obs) exceeds upper/lower confidence bound.

For example, change these lines
Code:
"DEF:fail=$rrds[0]:$rrd_var:FAILURES",
"TICK:fail#ffffa0:1.0:\"Failures\"",
to
Code:
"CDEF:fail=obs,upper,GT,INF,obs,lower,LT,INF,UNKN,IF,IF",
"AREA:fail#ffffa0:\"Failures\"",

The above CDEF means (maybe):
Code:
IF obs > upper then
   result = INF
else
   IF obs < lower then
      result = INF
   else
      result = UNKN
   endif
endif


Top
 Profile  
 
 Post subject: Re: Holt-Winters plugin - plots
PostPosted: Wed Feb 22, 2012 8:28 am 
Offline

Joined: Tue Feb 08, 2011 4:11 pm
Posts: 4
Hi,

Window size = 1, threshold = 1.

And I will try your advice...


Top
 Profile  
 
 Post subject: Re: Holt-Winters plugin - plots
PostPosted: Thu Mar 01, 2012 5:03 pm 
Offline

Joined: Tue Feb 08, 2011 4:11 pm
Posts: 4
Hi,

with your change, the plot really yellows the area upper/lower than bounds. But in the original .rrd file all failures were the ones which were yellowed in the orig.plot. So the original plot was right, but plots wider boundaries - don't know why actually.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group