|
|
| Author |
Message |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Thu Jan 26, 2006 11:05 am Post subject: Multi CPU Utilization Graph |
|
|
Right, like many people I have many servers with multiple CPUs.
What I want to see is:
a graph which shows :
1) the average utilization over all CPUs (maybe as a light area in the "background")
2) the utilization of each CPU (perhaps as dark lines in the foreground).
That's it really...
Trying to work this out at the moment, worked out how to do part 2 on a case by case basis (as long as the individual data sources exist) - but now want to turn it into a template (using the convert to template function works but takes the data sources I used for the graph with it - instead of using the query...)
So how do you graph the average over 2 data sources? Create a new source?
Argon0
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Thu Jan 26, 2006 12:08 pm Post subject: |
|
|
| You can create a cdef that adds two data sources together. You might be able to do this by creating hidden graph objects (one "hidden" line per cpu) and then create a CDEF that was something like "a, b, +". The variables reflect the ordering of the graph objects btw.
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Fri Jan 27, 2006 5:44 am Post subject: |
|
|
Hokay - I thought I'd created a data source that included multiple cpu instances, but when I try to use it to create graphs I get this:
| Code: | /usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="UKEC4SI - Test Server - CPU Utilization Multi" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
DEF:a="/var/www/html/rra/ukec4si_test_server_cpu_194.rrd":cpu:AVERAGE \
DEF:b="/var/www/html/rra/ukec4si_test_server_cpu_194.rrd":cpu1:AVERAGE \
LINE1:a#FF0000:"CPU Utilization (CPU0)" \
GPRINT:a:LAST:"Current\:%8.0lf" \
GPRINT:a:AVERAGE:"Average\:%8.0lf" \
GPRINT:a:MAX:"Max\:%8.0lf\n" \
LINE1:b#0D006A:"CPU Utilization (CPU1)" \
GPRINT:b:LAST:"Current\:%8.0lf" \
GPRINT:b:AVERAGE:"Average\:%8.0lf" \
GPRINT:b:MAX:"Max\:%8.0lf"
RRDTool Says:
ERROR: opening '/var/www/html/rra/ukec4si_test_server_cpu_194.rrd': No such file or directory
|
i.e. the data source file doesn't exist.
The Data Source itself gives me this code:
| Code: | /usr/bin/rrdtool create \
/var/www/html/rra/ukec4si_test_server_cpu_194.rrd \
--step 300 \
DS:cpu:GAUGE:600:0:U \
DS:cpu1:GAUGE:600:1:1 \
DS:cpu2:GAUGE:600:2:2 \
DS:cpu3:GAUGE:600:3:3 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \ |
The file in question does not exit...[/i]
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Fri Jan 27, 2006 5:53 am Post subject: |
|
|
When I try and create the graph for a new host I get asked for:
Custom Data [Template: Host MIB - CPU Utilization]
Index Type
Index Value
Output Type ID
What (if anything) should I put here?
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Fri Jan 27, 2006 7:11 am Post subject: |
|
|
| After running the data source code through a terminal I create the file - I get the graph up now... Dunno it it'll contain any data though...
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Fri Jan 27, 2006 10:28 am Post subject: |
|
|
OK, I'm stuck - thought I knew what I was doing, but no, buggered if I can get it right!!!
At the moment wouldn't mind if all I could do was get two graphs...
1) Showing up to 4 cpus
2) shoing the average over up to 4 cpus
At the moment I'm going around in circles trying to get it to graph the separate CPUs - anybody offer any help?
Argon0
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Fri Jan 27, 2006 12:13 pm Post subject: HAYELP... |
|
|
Ok here is a graph I've managed to create of 4 CPUs on one box:
As you will see its not *quite* right, the Mean CPU function seems to give a different amount than you would expect - i.e. higher..
The function it uses is a CDEF I created which looks like this:
CDEF:cdefa=TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,c,c,UN,0,c,IF,IF,TIME,1138381205,GT,d,d,UN,0,d,IF,IF,TIME,1138381205,GT,e,e,UN,0,e,IF,IF,+,+,+,+,4,/ \
basically What I thought I was doing was a cdef which looks like this:
| Code: | Item Item Value
Item #1 Special Data Source: ALL_DATA_SOURCES_NODUPS
Item #2 Custom String: 4
Item #3 Operator: / |
Is there acdef function you can use which will give the average over all data sources?
What the CDEF I've created SEEMS to do is add up ALL the data sources (including itself) for the graph then divide by 4.... Which gives the higher value than the average should be - and leads to the MAX value being higher than 100%...
Here is the entire code for the graph.
| Code: | /usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Multi CPU Utilization on UKHALWEB1" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
DEF:a="/var/www/html/rra/ukhalweb1_cpu_97.rrd":cpu:AVERAGE \
DEF:b="/var/www/html/rra/ukhalweb1_cpu_97.rrd":cpu:AVERAGE \
DEF:c="/var/www/html/rra/ukhalweb1_cpu_98.rrd":cpu:AVERAGE \
DEF:d="/var/www/html/rra/ukhalweb1_cpu_99.rrd":cpu:AVERAGE \
DEF:e="/var/www/html/rra/ukhalweb1_cpu_100.rrd":cpu:AVERAGE \
CDEF:cdefa=TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,c,c,UN,0,c,IF,IF,TIME,1138381205,GT,d,d,UN,0,d,IF,IF,TIME,1138381205,GT,e,e,UN,0,e,IF,IF,+,+,+,+,4,/ \
CDEF:cdefb=TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,c,c,UN,0,c,IF,IF,TIME,1138381205,GT,d,d,UN,0,d,IF,IF,TIME,1138381205,GT,e,e,UN,0,e,IF,IF,+,+,+,+,4,/ \
AREA:cdefa#FAFD9E:"Mean CPU" \
GPRINT:cdefb:LAST:" Current\:%8.2lf %%" \
GPRINT:cdefb:MIN:"Min\:%8.2lf %%" \
GPRINT:cdefb:MAX:"Max\:%8.2lf %%\n" \
LINE1:b#0000FF:"CPU0" \
GPRINT:b:LAST:" Current\:%8.2lf %%" \
GPRINT:b:MIN:"Min\:%8.2lf %%" \
GPRINT:b:MAX:"Max\:%8.2lf %%\n" \
LINE1:c#00A348:"CPU1" \
GPRINT:c:LAST:" Current\:%8.2lf %%" \
GPRINT:c:MIN:"Min\:%8.2lf %%" \
GPRINT:c:MAX:"Max\:%8.2lf %%\n" \
LINE1:d#C4FD3D:"CPU2" \
GPRINT:d:AVERAGE:" Current\:%8.2lf %%" \
GPRINT:d:MIN:"Min\:%8.2lf %%" \
GPRINT:d:MAX:"Max\:%8.2lf %%\n" \
LINE1:e#FF0000:"CPU3" \
GPRINT:e:AVERAGE:" Current\:%8.2lf %%" \
GPRINT:e:MIN:"Min\:%8.2lf %%" \
GPRINT:e:MAX:"Max\:%8.2lf %%" |
| Description: |
|
| Filesize: |
42.11 KB |
| Viewed: |
66422 Time(s) |

|
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Mon Jan 30, 2006 8:33 am Post subject: |
|
|
ANybody got any ideas how I could
a) turn this graph into a generic template
b) get the average CPU utilisation over all CPUs to read correctly...
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Mon Jan 30, 2006 2:18 pm Post subject: Re: HAYELP... |
|
|
| argon0 wrote: | The function it uses is a CDEF I created which looks like this:
CDEF:cdefa=TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,b,b,UN,0,b,IF,IF,TIME,1138381205,GT,c,c,UN,0,c,IF,IF,TIME,1138381205,GT,d,d,UN,0,d,IF,IF,TIME,1138381205,GT,e,e,UN,0,e,IF,IF,+,+,+,+,4,/ \
DEF:a="/var/www/html/rra/ukhalweb1_cpu_97.rrd":cpu:AVERAGE \
DEF:b="/var/www/html/rra/ukhalweb1_cpu_97.rrd":cpu:AVERAGE \
| You included a data source twice. Please have a look at your graph template to reveal this ...
Reinhard
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Mon Jan 30, 2006 2:22 pm Post subject: |
|
|
| argon0 wrote: | ANybody got any ideas how I could
a) turn this graph into a generic template
b) get the average CPU utilisation over all CPUs to read correctly... |
a) Goto Graph Management and select the Graph; select Convert to Graph Template. To use this: Goto Graph Management and ADD. Choose the newly generated Graph Template and the host in question. Now you're getting the required data sources to select. AFAIK, this will ONLY work, if the Graph Template defines exactly the same number of Items you want to graph (e.g. the template holds for 4 CPUs, but your current host has only 3 => won't work). I'm currently looking at that stuff. Perhaps I'll find a workaround; but this may take time
b) see my post above
Reinhard
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Tue Jan 31, 2006 5:34 am Post subject: |
|
|
Yup - worked that out about the multi cdefs...
Graph template, well this kind of works, but the problem then becomes the data sources..
I've fudged a way around most of the problems. But still can't get it to graph/calculate the average utilsation over all cpus properly.
(I use the cdef Special Data Source: ALL_DATA_SOURCES_NODUPS, and divide by the number of cpus, this too high a value, as it includes this cdef in the calculation, e.g. I have two processors, one at 50% util, one at 40% util, the mean util should be 45%, but the calculation gives 72.5%, I think what is happening is it takes the 50 adds the 45 divides by two, adds the result of this calculation to the first two data sources, then divides by two again to get the final answer...) -- hayelp...
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Tue Jan 31, 2006 5:45 am Post subject: |
|
|
Here's the code for the graph:
| Code: | RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Multi CPU Utilization on UKHALWEB2" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
DEF:a="/var/www/html/rra/ukhalweb2_cpu_231.rrd":cpu:AVERAGE \
DEF:b="/var/www/html/rra/ukhalweb2_cpu_231.rrd":cpu:AVERAGE \
DEF:c="/var/www/html/rra/ukhalweb2_cpu_232.rrd":cpu:AVERAGE \
CDEF:cdefa=TIME,1138704170,GT,b,b,UN,0,b,IF,IF,TIME,1138704170,GT,b,b,UN,0,b,IF,IF,TIME,1138704170,GT,c,c,UN,0,c,IF,IF,+,+,2,/ \
AREA:cdefa#FAFD9E:"Mean CPU" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %%" \
GPRINT:cdefa:MIN:"Min\:%8.2lf %%" \
GPRINT:cdefa:MAX:"Max\:%8.2lf %%\n" \
LINE1:b#0000FF:"CPU0" \
GPRINT:b:LAST:" Current\:%8.2lf %%" \
GPRINT:b:MIN:"Min\:%8.2lf %%" \
GPRINT:b:MAX:"Max\:%8.2lf %%\n" \
LINE1:c#00A348:"CPU1" \
GPRINT:c:LAST:" Current\:%8.2lf %%" \
GPRINT:c:MIN:"Min\:%8.2lf %%" \
GPRINT:c:MAX:"Max\:%8.2lf %%\n" |
You will notice there are THREE data sources on this 2 CPU graph, 2 of which are the same (so no_dups should take care of that, surely...) - no idea why this is I've only defined 2 data sources in the graph & only been asked for 2 when I change the graph around...
again -- HAYELP!!!
|
|
| Back to top |
|
 |
Doraken
Joined: 31 Jan 2006 Posts: 2
|
Posted: Tue Jan 31, 2006 6:01 am Post subject: One important thing whent you hade some hole in your graphe |
|
|
If like me you have some Time Out on CPU request
you must add a minimu value to your CDEF command
like this
Item #1 Special Data Source: ALL_DATA_SOURCES_NODUPS Move Down Move Up Delete
Item #2 Custom String: 4 Move Down Move Up Delete
Item #3 Operator: + Move Down Move Up Delete
Item #4 Custom String: 4 Move Down Move Up Delete
Item #5 Operator: /
If you don't do this your graph will not display anymore information after applying the CDEF command
( you can't divide 0 by any number .... )
Here i put a value like one percent i think this is ok and don't make my graph too false
If someone hade an idea about the methode to bypass this limitation ?
|
|
| Back to top |
|
 |
argon0 Cacti User
Joined: 12 Mar 2004 Posts: 238
|
Posted: Tue Jan 31, 2006 6:09 am Post subject: |
|
|
| Is there any way to directly edit the RRD Tool command that leads to the graph - if there were I'd just need to delete one of the DEF commands...
|
|
| Back to top |
|
 |
Doraken
Joined: 31 Jan 2006 Posts: 2
|
Posted: Tue Jan 31, 2006 6:12 am Post subject: The template for exemple |
|
|
Here is the temple i hade generated with cacti export tool
| Description: |
| All cpu information for Server which hade 4 CPU |
|
 Download |
| Filename: |
cacti_graph_template_charge_total_cpu.xml |
| Filesize: |
21.08 KB |
| Downloaded: |
9176 Time(s) |
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|