[mrtg] Need help on CPU info collection

Li Wei Nan l.weinan at gmail.com
Tue Sep 9 05:38:40 CEST 2008


I can still not generate the CPU graph after adding GAUGE to my config.
I really have no idea now. The CPU graph generated by MRTG is not all  
'zero's, after I zoom the graph and seeing it careful, it doesn't  
generate CPU
statistics at all.

Here I'll give out my config completely:

In mrtg server, my config is:

#
# Define global options
#

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/ 
TCP-MIB.txt
workdir: /var/www/mrtg/


#
# CPU Monitoring
# (Scaled so that the sum of all three values doesn't exceed 100)
#

Target[cluster1.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public at 172.16.6.183  
+ ssCpuRawSystem.0&ssCpuRawSystem.0:public at 172.16.6.183 + ssCpuRawNice. 
0&ssCpuRawNice.0:public at 172.16.6.183
Title[cluster1.cpu]: Server CPU Load
PageTop[cluster1.cpu]: <H1>CPU Load For Cluster1- System, User and  
Nice Processes</H1>
MaxBytes[cluster1.cpu]: 100
ShortLegend[cluster1.cpu]: %
YLegend[cluster1.cpu]: CPU Utilization
Legend1[cluster1.cpu]: Current CPU percentage load
LegendI[cluster1.cpu]: Used
LegendO[cluster1.cpu]:
Options[cluster1.cpu]: gauge,withzeroes,noo,growright
Unscaled[cluster1.cpu]: ymwd


Here I also want to give out my memory stat config(which works  
correctly):

#
# Memory Monitoring (Total Versus Available Memory)
#


Target[cluster1.memory]: memAvailReal.0&memTotalReal.0:public at 172.16.6.183
Title[cluster1.memory]: Free Memory
PageTop[cluster1.memory]: <H1>Free Memory For Cluster1</H1>
MaxBytes[cluster1.memory]: 100000000000
ShortLegend[cluster1.memory]: B
YLegend[cluster1.memory]: Bytes
LegendI[cluster1.memory]: Free
LegendO[cluster1.memory]: Total
Legend1[cluster1.memory]: Free memory, not including swap, in bytes
Legend2[cluster1.memory]: Total memory
Options[cluster1.memory]: gauge,growright,nopercent
kMG[cluster1.memory]: k,M,G,T,P,X


And I don't think there's any problem in snmpd config in target  
machine, because I can get the CPU info correctly on mrtg server:
snmpwalk -v 1 -c public 172.16.6.183 UCD-SNMP-MIB::ssCpuRawUser
UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 1230311

  snmpwalk -v 1 -c public 172.16.6.183 UCD-SNMP-MIB::ssCpuRawSystem
UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 1072451

I don't know why Memory collection works but CPU stat not work,  
because they are using the same MIB and have very similar configs.

I'm really frustrated because I cannot find where I'm wrong. Can  
anyone help me?

Thanks!

- Li Wei Nan
	
On Sep 3, 2008, at 7:04 AM, Steve Shipway wrote:

> Let me guess – you’re storing and displaying just zeros, right?
>
> You need to read up on the difference between a COUNTER (the default  
> MRTG mode) and a GAUGE.
>
> A COUNTER is a total count, such as with network traffic.  Here, you  
> want to graph the RATE OF CHANGE of the value.
>
> A GAUGE is an absolute value.  Here, you want to graph the  
> UNMODIFIED VALUE.
>
> Since a CPU usage is a gauge (IE, it is not a constantly increasing  
> count, such as with network bytes transmitted) you need to add the  
> ‘gauge’ option, otherwise you will graph the rate of change, which  
> will usually be zero.  You can think of the CPU usage OID as a  
> ‘number of seconds CPU time used per second’, IE a rate.  Since it  
> is already a rate, you do not want the default ‘counter’ mode.
>
> Similarly, with a memory value, you will probably want the ‘gauge’  
> option.
>
> If (for example) you were monitoring a count of total pages printed  
> by a printer, then this would be a ‘counter’ and you’d want to see  
> the rate of change instead.
>
> Summary:  always add the gauge option, unless you’re sure the value  
> you are retrieving is a constantly increasing count rather than a  
> rate.
>
> You probably want to add the ‘noo’ option as well to suppress the  
> second line.
>
> If you’re using routers2 as your frontend, also add the extended  
> options ‘fixunit’ and ‘nototal’.  It will help the display look  
> better for small values.
>
> Steve
>
>           Target[cluster1.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public at 172.16.6.183 
>  + ssCpuRawSystem.0&ssCpuRawSystem.0:public at 172.16.6.183 +  
> ssCpuRawNice.0&ssCpuRawNice.0:public at 172.16.6.183
>           Title[cluster1.cpu]: Server CPU Load
>           PageTop[cluster1.cpu]: <H1>CPU Load For Cluster1- System,  
> User and Nice Processes</H1>
>           MaxBytes[cluster1.cpu]: 100
>           ShortLegend[cluster1.cpu]: %
>           YLegend[cluster1.cpu]: CPU Utilization
>           Legend1[cluster1.cpu]: Current CPU percentage load
>           LegendI[cluster1.cpu]: Used
>           LegendO[cluster1.cpu]:
>           Options[cluster1.cpu]: growright,nopercent
>           Unscaled[cluster1.cpu]: ymwd
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20080909/bc14e424/attachment.html 


More information about the mrtg mailing list