Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Least Square Line

 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
Mikf



Joined: 13 Aug 2004
Posts: 36
Location: Paris, France

PostPosted: Wed Oct 17, 2007 2:19 pm    Post subject: Least Square Line Reply with quote

hi!
i'm writing a patch to use the LSL (least square line) of rrdtool ( http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html )
Only for rrdtool version 1.2.x

I have created 4 new 'Special Data Source' for CDEF function :
    CURRENT_DS_LSLSLOPE : return the LSLSCOPE variable of rrdtool
    CURRENT_DS_LSLINT : return the LSLINT variable of rrdtool
    CURRENT_DS_LSLCORREL : return the LSLCORREL variable of rrdtool (not tested)
    CURRENT_DS_LSLFUNCTION : return the y=ax+b function (y=LSLSCOPE * x + LSLINT)

To use the LSL function, VDEF definitions must be created in the rrdgraph command. This is what my path is doing.


CURRENT_DS_LSLFUNCTION can be used alone in a CDEF function, this will trace the line, but if the datasource is used with a CDEF function (like 'turn byte into bits'), you may create a CDEF with CURRENT_DS_LSLFUNCTION and the same operation.

exemple : if your graph is using "Turn Bytes into bits"
"Turn Bytes into bits" cdef=CURRENT_DATA_SOURCE,8,*
then , to trace the LSL line, create a cdef function like this:
"LSL Turn Bytes into bits" cdef=CURRENT_DS_LSLFUNCTION,8,*

note: LSL's functions cannot be used alone, in a CDEF function, a data_source must be present.
(exepted the CURRENT_DS_LSLFUNCTION that include automaticaly a datasource and POP it (remove from the stack in cdef))

to display the percent of evolution of the graphed period, create a cdef function
cdef=CURRENT_DATA_SOURCE,POP,CURRENT_DS_LSLSLOPE,COUNT,*,CURRENT_DS_LSLINT,0,LE,0.1,CURRENT_DS_LSLINT,IF,/,100,*
and use a GPRINT with "LAST" as Consolidation Function


Patch is for cacti 0.8.6j without official patch
copy the patch file in cacti directory
be in cacti directory to apply the patch
if you want to test before :
patch -p1 -N --dry-run < lsl.patch

patch:
patch -p1 -N < lsl.patch

-
Jerome

Sorry for my english

EDIT: version 1.1 : trace line even if data value is unknown (cf picture 2)
EDIT : version 1.2: simplify function



LSL1.1.jpg
 Description:
LSL exemple version 1.1
line is drawn even if data is unknown
 Filesize:  40.82 KB
 Viewed:  8109 Time(s)

LSL1.1.jpg



lsl.jpg
 Description:
LSL exemple
 Filesize:  41.19 KB
 Viewed:  8170 Time(s)

lsl.jpg



lsl-1.2.patch
 Description:
Patch version 1.2, oct 18 2007
for cacti 0.8.6j

Download
 Filename:  lsl-1.2.patch
 Filesize:  4.62 KB
 Downloaded:  202 Time(s)



Last edited by Mikf on Thu Oct 18, 2007 4:34 am; edited 9 times in total
Back to top
chrisgapske
Cacti User


Joined: 22 May 2007
Posts: 268
Location: Padacuh, Ky-Alpena, MI-Gulf Shores,AL

PostPosted: Wed Oct 17, 2007 2:46 pm    Post subject: Interesting Reply with quote

Have you tested this with 0.8.7 beta 4/SVN ?


Would be nice to have added to cacti base.
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5453
Location: Wisconsin, USA

PostPosted: Wed Oct 17, 2007 2:51 pm    Post subject: Reply with quote

VDEF will be coming, not in 0.8.7. But will be in an upcoming release.
Back to top
Mikf



Joined: 13 Aug 2004
Posts: 36
Location: Paris, France

PostPosted: Wed Oct 17, 2007 3:32 pm    Post subject: Re: Interesting Reply with quote

chrisgapske wrote:
Have you tested this with 0.8.7 beta 4/SVN ?

No, only with 0.8.6j
rony wrote:

VDEF will be coming, not in 0.8.7. But will be in an upcoming release.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group