Discussion:
Adding a straight line trend to a multigraph report
kerickson
2013-01-29 05:44:26 UTC
Permalink
kerickson [http://community.zenoss.org/people/kerickson] created the discussion

"Adding a straight line trend to a multigraph report"

To view the discussion, visit: http://community.zenoss.org/message/71257#71257

--------------------------------------------------------------
Let's say you've made a nice multi graph report of the CPU utilization on your Windows servers. Maybe it looks like this one:

Loading Image... Loading Image...
If you haven't generated a multigraph report before, then a quick summary of the steps I followed is:
1) Create a new multigraph report
2) Create a Collection and add the Device Class +/Servers/Windows/WMI+ to it
3) Create a Graph Definition, adding the Graph Point +ProcessorTotalProcessorTime_ProcessorTotalProcessorTime+
4) Add a Graph Group, linking the Collection to the Graph Definition

That's a nice report of the raw data - but what you really want is a trend line through the data, so you can guess at the future.Something like this:
Loading Image... Loading Image...
Much spiffier!

How can you do this? Take advantage of the Graph Custom Definition associated with the Graph Definition from step 3 above.

The Graph Custom Defintion name seems a little inside out to me. It would make more sense as Custom Graph Definition. What it does is gives us a place to enter RRD commands.

Here are the commands I entered:

Loading Image... Loading Image...

Let's break the commands down with individual explanations.

First, I wanted to use data for the last 30 days, so I used the start command to go back 30 days from now. "n" is shorthand for "now."
--start=n-30d

And I wanted to see my trend line extend off into the next week, so I used the end command to extend the graph seven days into the future.
--end=n+7d

I was pasting in some code that already used the RRD variable name CPU_Usage. But the available RRD variable for CPU on the Windows servers was ProcessorTotalProcessorTime - you can see that on the bottom of the screen, under "Available RRD Variables". So I set the variable CPU_Usage equal to the ProcessorTotalProcessorTime.
CDEF:CPU_Usage=ProcessorTotalProcessorTime

Now to calculate the trend line. RRDtool includes least squares math functions, so this is straightforward. The first VDEF determines the slope of the line, the second its intercept (where it would be zero). The CDEF uses some RPN math to calculate the line.
VDEF:slope=CPU_Usage,LSLSLOPE
VDEF:cons=CPU_Usage,LSLINT
CDEF:leastsquareline=CPU_Usage,POP,slope,COUNT,*,cons,+

Finally, I tell RRDtool to add the trend line in a catchy shade of bright red, and add a description in the graph legend.
LINE2:leastsquareline#FF0000:Least_Square_Prediction

That's all it took. These two servers were kind of boring, so I attached the same set of commands to a broader set of servers, our ESX server farm.
Loading Image... Loading Image...
Now there's some value - with this report I can figure out which servers are getting busier and which servers I might move some busy VMs to!

You can add trend lines to the graphs in individual device graphs, too. I've found two issues - if you set start and end times, the standard Zenoss zoom functions ignore them. And if you make a typo, the graph simply breaks with no errors shown. That makes doing it the first time a bit challenging.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/71257#71257]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
kerickson
2013-01-29 06:28:13 UTC
Permalink
kerickson [http://community.zenoss.org/people/kerickson] created the discussion

"Re: Adding a straight line trend to a multigraph report"

To view the discussion, visit: http://community.zenoss.org/message/71258#71258

--------------------------------------------------------------
This was first discussed five years ago! http://community.zenoss.org/message/13910#13910#13910 http://community.zenoss.org/message/13910#13910
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/71258#71258]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...