[mrtg] Monitoring CPU Utilization on a CentOS Machine

Max Hetrick maxhetrick at verizon.net
Thu Sep 24 13:18:43 CEST 2009


Matt Baer wrote:
> Hello.
> 
> I'm having some issues getting the CPU utilization for any machine.  For 
> testing purposes, I'll only include one machine here.  It is a single 
> core CPU running CentOS.  The machine that MRTG is running on is Ubuntu 
> 9.04 Desktop and it's using MRTGv2.16.2.  Here the relevant portion of 
> my mrtg.cfg file:
> 
> LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
> Target[mailserv.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public at 10.0.0.10 + 
> ssCpuRawSystem.0&ssCpuRawSystem.0:public at 10.0.0.10 + 
> ssCpuRawNice.0&ssCpuRawNice.0:pub$
> MaxBytes[mailserv.cpu]: 100
> Title[mailserv.cpu]: CPU LOAD
> PageTop[mailserv.cpu]: <H1>Active CPU Load %</H1>
> Unscaled[mailserv.cpu]: ymwd
> ShortLegend[mailserv.cpu]: %
> YLegend[mailserv.cpu]: CPU Utilization
> Legend1[mailserv.cpu]: Active CPU in % (Load)
> Legend2[mailserv.cpu]:
> Legend3[mailserv.cpu]:
> Legend4[mailserv.cpu]:
> LegendI[mailserv.cpu]:  Active
> LegendO[mailserv.cpu]:
> Options[mailserv.cpu]: growright,nopercent,gauge
> 
> I have tried many many many different changes to this but they all 
> warrant the same results.  I get a graph, but nothing populates within 
> the graph.  I notice that I'm getting things in the /var/mail/root.  
> Here is my latest excerpt from that:
> 
> Unknown SNMP var ssCpuRawUser.0
>  at /usr/bin/mrtg line 2207
> Unknown SNMP var ssCpuRawUser.0
>  at /usr/bin/mrtg line 2207
> 2009-09-24 00:35:01: WARNING: Expected a number but got '11:49:28'
> 2009-09-24 00:35:01: WARNING: Expected a number but got 'nas2'
> Unknown SNMP var ssCpuRawSystem.0
>  at /usr/bin/mrtg line 2207
> Unknown SNMP var ssCpuRawSystem.0
>  at /usr/bin/mrtg line 2207
> 2009-09-24 00:35:01: WARNING: Expected a number but got '11:49:28'
> 2009-09-24 00:35:01: WARNING: Expected a number but got 'nas2'
> Unknown SNMP var ssCpuRawNice.0
>  at /usr/bin/mrtg line 2207
> Unknown SNMP var ssCpuRawNice.0
>  at /usr/bin/mrtg line 2207
> 2009-09-24 00:35:01: WARNING: Expected a number but got '11:49:28'
> 2009-09-24 00:35:01: WARNING: Expected a number but got 'nas2'
> Unknown SNMP var ssCpuRawUser.0
>  at /usr/bin/mrtg line 2207
> Unknown SNMP var ssCpuRawUser.0
>  at /usr/bin/mrtg line 2207
> 2009-09-24 00:35:01: WARNING: Expected a number but got '34 days, 7:01:39'
> 2009-09-24 00:35:01: WARNING: Expected a number but got 'mail.server.com'
> Unknown SNMP var ssCpuRawSystem.0
>  at /usr/bin/mrtg line 2207
> Unknown SNMP var ssCpuRawSystem.0
>  at /usr/bin/mrtg line 2207
> 2009-09-24 00:35:01: WARNING: Expected a number but got '34 days, 7:01:39'
> 2009-09-24 00:35:01: WARNING: Expected a number but got 'mail.server.com'
> Unknown SNMP var ssCpuRawNice.0
>  at /usr/bin/mrtg line 2207
> Unknown SNMP var ssCpuRawNice.0
>  at /usr/bin/mrtg line 2207
> 2009-09-24 00:35:01: WARNING: Expected a number but got '34 days, 7:01:39'
> 2009-09-24 00:35:13: ERROR: Target[localhost.cpu][_IN_] ' 
> $target->[18]{$mode} +  $target->[19]{$mode} +  $target->[20]{$mode} ' 
> (warn): Use of uninitialized value in addition (+) at (eval 54) line 1.
> 2009-09-24 00:35:13: ERROR: Target[localhost.cpu][_OUT_] ' 
> $target->[18]{$mode} +  $target->[19]{$mode} +  $target->[20]{$mode} ' 
> (warn): Use of uninitialized value in addition (+) at (eval 55) line 1.
> 2009-09-24 00:35:13: ERROR: Target[mailserv.cpu][_IN_] ' 
> $target->[22]{$mode}  +  $target->[23]{$mode}  +  $target->[24]{$mode} ' 
> (warn): Use of uninitialized value in addition (+) at (eval 58) line 1.
> 2009-09-24 00:35:13: ERROR: Target[mailserv.cpu][_OUT_] ' 
> $target->[22]{$mode}  +  $target->[23]{$mode}  +  $target->[24]{$mode} ' 
> (warn): Use of uninitialized value in addition (+) at (eval 59) line 1.
> 
> As I'm sure you've noticed, it's almost as iff ssCpuRawUser.0 returns 
> 'uptime'.  I cannot find an answer that works anywhere.  Does anyone 
> have a fix for this?

Have you tried the actual OID path?  I'm graphing a CPU load in CentOS 4 
with the following:

Target[machine_1]: 
1.3.6.1.4.1.2021.11.50.0&1.3.6.1.4.1.2021.11.50.0:public at machine + 
1.3.6.1.4.1.2021.11.52.0&.1.3.6.1.4.1.2021.11.52.0:public at machine + 
.1.3.6.1.4.1.2021.11.51.0&.1.3.6.1.4.1.2021.11.51.0:public at machine
MaxBytes[machine_1]: 100
Title[machine_1]: CPU LOAD
PageTop[machine_1]: <H1>Active CPU Load % (2 CPUs)</H1>
Unscaled[machine_1]: ymwd
ShortLegend[machine_1]: %
YLegend[machine_1]: CPU Utilization
Legend1[machine_1]: Active CPU in % (Load)
Legend2[machine_1]:
Legend3[machine_1]:
Legend4[machine_1]:
LegendI[machine_1]:  Active
LegendO[machine_1]:
Options[machine_1]: growright,nopercent

Try it out with the actual OID here and see what you get.

Regards,
Max



More information about the mrtg mailing list