Drawing Load Average and CPU usage on ONE graph?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
alexs77
Posts: 41
Joined: Tue May 26, 2009 7:31 am
Location: Winterhtur, Switzerland

Drawing Load Average and CPU usage on ONE graph?

Post by alexs77 »

Hi.

I'm looking for a template for drawing the CPU Usage (as graphed by "ucd/net - CPU Usage") and also the 1 Minute Load Average (as on "Unix - Load Average") on ONE graph.

Does anyone know if there's a template for this around?

The problem I see with creating this is, that those "two" values aren't (necessarily) linked together - ie. the load can range between 0.01 and eg. 20, but it might also be just at about eg. 0.5 - hence the "Use --alt-autoscale-max (accepting a lower limit)" setting.

But the CPU Usage is always between 0% and 100%.

So we'd need to have two seperate Y-Axis. This isn't supported by Cacti right now IIRC.

Q: Does someone know of a good template which would draw those values on one graph?

Thanks,
Alexander
Deviloper
Cacti User
Posts: 256
Joined: Tue Jul 07, 2009 8:03 am

Post by Deviloper »

Are you sure, you don´t "fool" your operators doing this kind of "tricks"?

Also System Load is a very unspecific value. Different Systems have different max. Load-Values. Depending on many system parameters like OS-type, Hardwarearchitecture, Ram, CPUs...

If you known the max. Load-Value of your System you can use a CDEF to calculate the Load-Percentage from Current-Load. So you only need 1 Scale the 0-100%.

(Also I would not recommend putting different values in one graph.)
alexs77
Posts: 41
Joined: Tue May 26, 2009 7:31 am
Location: Winterhtur, Switzerland

Post by alexs77 »

Hm, there is no maximum load value (in theory). And if you draw both of these values on one graph, you'll see, that quite often the CPU Usage idle goes down (or Kernel and/or User goes up) if the Load increases. But it doesn't have to, of course.

It's also quite often the case, that CPU Usage increases, if network traffic increases. So it would be very nice to be able to draw CPU Usage against Network Traffic.

To see the relationship (or non-relationship...) of both figures, it indeed does make sense to have both on one graph.

Back to the Q: I do not know the max load. I cannot know, as there's no such value *G* How do I come around the requirement for having two scales? As I see it, I need two, so that usage is drawn between 0 and 100 and load in the ranges it is shown on the graph.

I suppose the way to go would be to define a new CDEF which scales the current data source between it's current min and max values to 0..100. Does anyone have a RPN or CDEF at hand, which does just that?

PS: I'm thinking about Unix here. Dunno how it is in the Windows world.
alexs77
Posts: 41
Joined: Tue May 26, 2009 7:31 am
Location: Winterhtur, Switzerland

Post by alexs77 »

I'm no good in RPN, but wouldn't the following be correct?

Code: Select all

CURRENT_DS_SOURCE * ( 100 / ( MAX(CURRENT_DS_SOURCE) ) )
Is there a function which returns the highest value from this data source on the graph? The RRDTool MAX() function doesn't do that:
Comparing values

MIN, MAX

Pops two elements from the stack and returns the smaller or larger, respectively. Note that infinite is larger than anything else. If one of the input numbers is unknown then the result of the operation will be unknown too.
Deviloper
Cacti User
Posts: 256
Joined: Tue Jul 07, 2009 8:03 am

Post by Deviloper »

Using the highest value (max) you have seen, would be a workaround I would, too, have choosen.

But there is also a way you can get the max. load. Run an mutlithread io-benchmark utility against your machine. (Sniffering a crowded 1GBit/s should do... ) Htere are some unix linux benchmarks out there.... some people would call Oracle 10g a good bechmark utility...

Can´t tell anything about RPN... I hate it. But there are Commandline-Calculators you can use to debug RPN for Linux. I did so.
alexs77
Posts: 41
Joined: Tue May 26, 2009 7:31 am
Location: Winterhtur, Switzerland

Post by alexs77 »

Deviloper wrote:Using the highest value (max) you have seen, would be a workaround I would, too, have choosen.
But how would I do that? max() doesn't return the highest value - at least not in a way I need it. If I understood it right, "max(47, 11)" would return 47 - it compares two numbers and returns the biggest.

But I'd need a "function" which returns the higgest number seen. At first, I thought CURRENT_DS_MAXIMUM_VALUE would be it - but no, that returns the defined maximum for the data source. Also CURRENT_GRAPH_MAXIMUM_VALUE isn't the right special data source - it would return 100, because I want the graph max. value to be 100.

Having 2 Y-Axis would be good :(

Thanks,
Alexander
alexs77
Posts: 41
Joined: Tue May 26, 2009 7:31 am
Location: Winterhtur, Switzerland

Post by alexs77 »

Deviloper wrote:But there is also a way you can get the max. load. Run an mutlithread io-benchmark utility against your machine.
Wouldn't help much. This might tell me something like a "max" value. But in general, the machine isn't run at the max value. It seems to be at about 3-4 max. But that's not the max it can support. And there are sometimes spikes. That's why it would be kinda required to get the maximum value which has been (or: "would be") drawn on the graph.

Alexander
Deviloper
Cacti User
Posts: 256
Joined: Tue Jul 07, 2009 8:03 am

Post by Deviloper »

in your example max returns 47, because it is the largest value.
If you dived it by 100 you get one percent. While 47 would be 100 %. Therefor you can see 47 as 100%... if a new max value appears this will become your new base for 100%.

You translate the current value as "percents of 47" or percents of Max.

I would write that:

CURRENT_DS_SOURCE / ( 100 / ( MAX(CURRENT_DS_SOURCE) ) )

(Also math never was my domain.)

Try out the commandline rpn calc tool.
alexs77
Posts: 41
Joined: Tue May 26, 2009 7:31 am
Location: Winterhtur, Switzerland

Post by alexs77 »

Deviloper wrote:in your example max returns 47, because it is the largest value.
Yes, the question, however, is how to get 47 in the first place. :D

Also, MAX(CURRENT_DS_SOURCE) wouldn't work. From the rrd rpn manual:
Comparing values

MIN, MAX

Pops two elements from the stack and returns the smaller or larger, respectively. Note that infinite is larger than anything else. If one of the input numbers is unknown then the result of the operation will be unknown too.
Ie. MAX() would need TWO arguments. Kinda like: MAX(A,B). This would translate to:

Code: Select all

a < b ? a : b
or:

if a < b; then
  return a;
else
  return b;
end
Best regards,
Alexander
Deviloper
Cacti User
Posts: 256
Joined: Tue Jul 07, 2009 8:03 am

Post by Deviloper »

IHHHKKKK.... If I stumble above a solution, I´ll let you know.

Did you try this?
MAX(CURRENT_DS_SOURCE,)
^
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests