Discussion:
[rrd-users] [GRAYMAIL] RE: RE: Question about trend line
(too old to reply)
rseiwert
2015-08-12 19:01:25 UTC
Permalink
The Least Squares Line (LSL) in RRD just produces a line. Just a line. It doesn't bend. It takes all the data points you have and calculates a line that best approximates a path that passes through all data points. The relatively high values on the end of your graph gives your LSL trend a high slope and the negative values at the beginning. There are better ways to forecast usage than LSL but they also add complexity into the mix.

LSLSLOPE, LSLINT, LSLCORREL (from http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html)
Return the parameters for a Least Squares Line (y = mx +b) which approximate the provided dataset. LSLSLOPE is the slope (m) of the line related to the COUNT position of the data. LSLINT is the y-intercept (b), which happens also to be the first data point on the graph. LSLCORREL is the Correlation Coefficient (also known as Pearson's Product Moment Correlation Coefficient). It will range from 0 to +/-1 and represents the quality of fit for the approximation.

You are right, step is not related to your issue but step size will impact your results. Just a warning not to open your graph's date range too far to avoid averaging/watering down your data. If you use LSLCORREL (which I do) to validate the trend watering down your data will also inflate and produce an invalid correlation coefficient.

From: Ondrej [via RRD Mailinglists] [mailto:ml-node+***@n2.nabble.com]
Sent: Wednesday, August 12, 2015 2:22 PM
To: Robert C. Seiwert <***@vcaglobal.com>
Subject: [GRAYMAIL] RE: RE: Question about trend line

Thank you for comprehensive response. I am actually monitoring WAN0 interface data traffic, so problem is not related to disk space monitoring. I also watched the YT presentation and found this very useful. You are right, that my graph had limits set and when i removed them i got graph like this, having negative integer at first two days. Admitting i am not sure how your method step size method can remedy my problem, that trend line goes to negative area. can you explain further?

[Loading Image...]
________________________________
If you reply to this email, your message will be added to the discussion below:
http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583083.html
To start a new topic under RRDtool Users Mailinglist, email ml-node+***@n2.nabble.com<mailto:ml-node+***@n2.nabble.com>
To unsubscribe from RRD Mailinglists, click here<http://rrd-mailinglists.937164.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=937164&code=cm9iQHZjYWdsb2JhbC5jb218OTM3MTY0fC0yMTE0MzU4MzIz>.
NAML<http://rrd-mailinglists.937164.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583084.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Ondrej
2015-08-12 19:52:27 UTC
Permalink
OK, this is clear how LSL should work, but since graph very beginning there
as positive values (i double checked now using rrd dump) and there are never
any negative values, so i'd still assume LSL will take these first two days
into consideration. Now it looks to me that there are just ignored. In other
words between 4-6 of august there are 5 minutes step always positive values.



--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583085.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
rseiwert
2015-08-12 22:03:52 UTC
Permalink
Those initial values are not ignored and are used in the least squares calculation. The problem is that all the data is taken into consideration, the initial few values near zero and the final values near 3000. To get to the 3000 the slope is great enough that the line needs to start in the basement. You can put the limit back on and it will stop at zero. Unless your slope is zero every line will eventually have a negative y. When your trend is "downhill" you will have a negative slope and the values will go negative at some point in the future. Bogus data, such as when you first start monitoring, can also skew your trend. There are graphs that show the same trend line but common sense will tell you LSL is only accurate on the first.
[Loading Image...]
FYI with your date range you are using in the graph of 30 days on graph 1900 pixels large I'm guessing the step used in your calculations is more like 1 hour.

As your data looks like it is in flux right now. I would change your date range to trend only the last 48 hours and you will get a much different trend line. On some of my graphs I use three trend lines that are hardcoded for immediate (1 day), longer (2 days), and even longer (a week) and they rarely agree. The link below shows how to hardcode this.

http://hints.jeb.be/2009/12/04/trend-prediction-with-rrdtool/

BTW, if this is a WAN port shouldn't the label be megabits/sec or some other rate and not total megabytes.
The graph below you can see that the bogus data from last week is skewing the trend down

[cid:***@01D0D527.06260460]
The one week trend here is bogus due to an equipment change.

From: Ondrej [via RRD Mailinglists] [mailto:ml-node+***@n2.nabble.com]
Sent: Wednesday, August 12, 2015 3:52 PM
To: Robert C. Seiwert <***@vcaglobal.com>
Subject: [GRAYMAIL] RE: RE: Question about trend line

OK, this is clear how LSL should work, but since graph very beginning there as positive values (i double checked now using rrd dump) and there are never any negative values, so i'd still assume LSL will take these first two days into consideration. Now it looks to me that there are just ignored. In other words between 4-6 of august there are 5 minutes step always positive values.
________________________________
If you reply to this email, your message will be added to the discussion below:
http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583085.html
To start a new topic under RRDtool Users Mailinglist, email ml-node+***@n2.nabble.com<mailto:ml-node+***@n2.nabble.com>
To unsubscribe from RRD Mailinglists, click here<http://rrd-mailinglists.937164.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=937164&code=cm9iQHZjYWdsb2JhbC5jb218OTM3MTY0fC0yMTE0MzU4MzIz>.
NAML<http://rrd-mailinglists.937164.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


image001.png (166K) <Loading Image...>
image002.gif (2K) <Loading Image...>




--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583086.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Ondrej
2015-08-13 11:36:22 UTC
Permalink
Thank you again for great explanation. My graph shows total consumed data on
WAN0 interface, so not units/sec but total Megabytes that went over this
interface in range of 30 days.

Reading all this about LSL* I think I should maybe reconsider using LSL
functions here and find another way of predicting.

vnstat linux tool gives me prediction that if far different than LSL* ( 9.81
GiB currently is predicted whereas LSL gives almost 12GiB.)

Maybe using HRULE and the predicted value from vnstat would be a direction.





--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583087.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
Loading...