<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:2102023131;
        mso-list-type:hybrid;
        mso-list-template-ids:-1651737366 134807553 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1
        {mso-list-id:2125296986;
        mso-list-template-ids:-1262059976;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-GB link=blue vlink=blue id=MailContainerBody
leftmargin=0 topmargin=0 CanvasTabStop=true name="Compose message area">

<div class=Section1>

<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>Your configuration has:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Target[cpu]: `/usr/bin/awk '/cpu /{print $2+$3; print
$2+$3+$4; print &quot;quite some time&quot;; print
&quot;domain.com&quot;}'&lt;/proc/stat`</span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>MaxBytes[cpu]: 100</span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Options[cpu]: nopercent,growright,noinfo,bits</span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>You are getting your CPU info from
/proc/stat, and the cpu line.&nbsp; However, this line does not contain a count
of seconds used.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>See this page: <a
href="http://www.linuxhowtos.org/System/procstat.htm">http://www.linuxhowtos.org/System/procstat.htm</a><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Since you are using counter mode (ie, no &#8216;gauge&#8217;
option) then you will be graphing the rate of change of these counters. &nbsp;So
far so good.&nbsp; But you want this in percent, so basically, you need:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>(CPU seconds used)/(seconds available)*100%<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Now, the CPU count is NOT in
seconds.&nbsp; It is in &#8216;jiffies&#8217;, which are typically (but not
always) 0.01 seconds. &nbsp;You can check the actual value of USER_HZ in the
include/asm/param.h file under your kernel source directory. &nbsp;Therefore,
you need:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>((change in CPU count)/100)/(seconds available)*100%<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Excellent &#8211; the 100s cancel out, and
we should be OK!&nbsp; I assume you&#8217;ve already worked things out this far&#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>But Wait!&nbsp; We have 4 CPUs on the
machine, so the &#8216;seconds available&#8217; is actually 4 times the &#8216;seconds
passed&#8217;. &nbsp;This means we need:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>(change in CPU count)/((seconds passed)*(number
of CPUs))<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The &#8216;/(seconds passed)&#8217; is
done automatically by MRTG when it does its polling. &nbsp;So, our Target
definition needs to return:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>(change in CPU count)/(number of CPUs)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The columns on the CPU line corresponds to:<o:p></o:p></span></font></p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>label<o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>user:
     normal processes executing in user mode <o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>nice:
     niced processes executing in user mode <o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>system:
     processes executing in kernel mode <o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>idle:
     twiddling thumbs <o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>iowait:
     waiting for I/O to complete <o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>irq:
     servicing interrupts <o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo2'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>softirq:
     servicing softirqs<o:p></o:p></span></font></li>
</ul>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Now, you want to graph (user time) and
(total time used), which are ($2) and ($2+$4+$6)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Target[cpu]: `/usr/bin/awk '/cpu /{print ($2/4); print (($2+$4+$6)/4);
print &quot;quite some time&quot;; print
&quot;domain.com&quot;}'&lt;/proc/stat`<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>So, lets try running that to test:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>$ /usr/bin/awk '/cpu /{print ($2/4);
print (($2+$4+$6)/4); print &quot;quite some time&quot;; print
&quot;domain.com&quot;}'&lt;/proc/stat<o:p></o:p></span></font></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>1.02992e+06<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>1.74553e+06<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>quite
some time<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>domain.com<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>$<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Oh no, what&#8217;s gone wrong here? &nbsp;Awk
is trying to be helpful and is printing in exponential notation, which MRTG doesn&#8217;t
understand.&nbsp; This would probably result in some very odd percentage
calculations. &nbsp;So lets fix that:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>$ /usr/bin/awk '/cpu /{printf
&quot;%f\n&quot;,($2/4); printf &quot;%f\n&quot;, (($2+$4+$6)/4); print
&quot;quite some time&quot;; print &quot;domain.com&quot;}'&lt;/proc/stat<o:p></o:p></span></font></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>1029936.750000<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>1745558.750000<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>quite
some time<o:p></o:p></span></font></b></p>

<p class=MsoNormal><b><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black;font-weight:bold'>domain.com<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>$<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This gives us the definition:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Target[cpu]: `/usr/bin/awk '/cpu /{printf
&quot;%f\n&quot;,($2/4); printf &quot;%f\n&quot;, (($2+$4+$6)/4); print
&quot;quite some time&quot;; print &quot;domain.com&quot;}'&lt;/proc/stat`<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This is probably what we need. &nbsp;Set
MaxBytes to 100 (as you have), and it should work. &nbsp;If you are using the
Routers2 frontend, then use the extended options &#8216;fixunit&#8217;, &#8216;nopercent&#8217;
and &#8216;nototal&#8217; so that the percentages are handled correctly.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Steve<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>