[mrtg] Re: Does anyone have a 'clue' on what I need to do to get the ProcessorLoad to graph out?

Neil Calvert ncalvert at cabletron.com
Mon Oct 18 15:14:47 MEST 1999


Robin,

I'm monitoring CPU on a solaris machine by using a script. The script
calls vmstat, formats the output, and passes the data back to MRTG. It's
run using rsh so the target in the config file is of the form

target[sun_box]:`rsh sunbox:/var/scripts/mycpuscript`

One of the scripts I use is as follows :

#!/bin/ksh
#Graph to give % of CPU used  by System and User vs % of CPU idle
vm2array[0]=`vmstat 1 2 | awk 'NR == 4 { printf "%d\n", $20 + $21 }'`
vm2array[1]=`vmstat 1 2 | awk 'NR == 4 { print $22 }'`
echo ${vm2array[0]}
echo ${vm2array[1]}
echo Uptime
echo your_machine_hostname_goes_here

You need to use the RouterUptime option in MRTG to provide the uptime
(make sure the sun box is running the SNMP agent).

Fairly crude.. but works. If security is a problem at your site you may
not want to use rsh, though.

Neil

  -----Original Message-----
  From: Robin Burger <robin.burger at bms.com>
  To: mrtg at list.ee.ethz.ch <mrtg at list.ee.ethz.ch>
  Date: Friday, October 15, 1999 5:51 PM
  Subject: [mrtg] Does anyone have a 'clue' on what I need to do to get
the ProcessorLoad to graph out?



  Hello everyone.  I am new here, and have not yet finished going
through the archive so this question may have been answered before...
  Does anyone have a 'clue' on what I need to do to get the Processor
Load to graph out?


  I am working trying to get MRTG to give me CPU stats...

  scully
     - SunOS      5.6
     - mrtg       2.8.6
     - UCD-snmp   4.0.1

  iceberg
     - Linux      2.2.5-15
     - UCD-snmp   3.6.1

  -=-=-=-=--= iceberg.cfg -=-=-=-=--=  (( this is the '''whole
ile'''  ))
  WorkDir: /export/home/mrtg/data
  Target[ICEBERG.wfd.pri.bms.com]:
1.3.6.1.2.1.25.3.3.1.2.769&1.3.6.1.2.1.25.3.3.1.2.769:public at iceberg
  MaxBytes[ICEBERG.wfd.pri.bms.com]: 1250000
  Title[ICEBERG.wfd.pri.bms.com]: iceberg (ICEBERG.wfd.pri.bms.com):
hrProcessorLoad
  PageTop[ICEBERG.wfd.pri.bms.com]: <H1>Traffic Analysis for
hrProcessorLoad
   </H1>
   <TABLE>
     <TR><TD>System:</TD><TD>iceberg in Look behind you</TD></TR>
     <TR><TD>Maintainer:</TD><TD>Greg Stiegler <stiegleg at bms.com>
</TD></TR>
     <TR><TD>Interface:</TD><TD>hrProcessorLoad (2)</TD></TR>
     <TR><TD>IP:</TD><TD>ICEBERG.wfd.pri.bms.com
(140.176.249.28)</TD></TR>
     <TR><TD>Max Speed:</TD>
         <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
    </TABLE>
  -^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^

  comment # # (( I have ran the snmpget command directly and I know that
the
  comment # #    result is returned.  And I know that it is integer ))
  comment #
   scully # snmpget -q -f iceberg public
hrDevice.hrProcessorTable.hrProcessorEntry.hrProcessorLoad.769

.iso.org.dod.internet.mgmt.mib-2.host.hrDevice.hrProcessorTable.hrProces
sorEntry.hrProcessorLoad.769 10
     1 . 3 . 6 .    1   . 2  .  1  . 25 .   3    .      3         .   1
.  2            .769
     1.3.6.1.2.1.25.3.3.1.2.769

  scully # LD_LIBRARY_PATH=/usr/lib:/usr/local/lib ; export
LD_LIBRARY_PATH
  scully # /export/home/src/mrtg/mrtg-2.8.6/run/mrtg.debug
/export/home/mrtg/configs/iceberg.cfg
  .
  .    ((((( note I modified the DEBUG flag and the lines to see that
the values are being created
  .
   - inlast( 2 )
   - outlast( 2 )
   - uptime( 4 days, 9:43:53 )
   - name( iceberg )
   - time( 940020397 )
  .
  .
  .
   << writegraphics - entrance >> 1

   writegraphics: inlast 2 outlast 2
   <><><><><><><><>  check
   /export/home/src/mrtg/mrtg-2.8.6/run//rateup /export/home/mrtg/data/
iceberg.wfd.pri.bms.com 940020397,  ? '-z':'-Z' u 2, 2, 1250000:
c#00cc00, #0000ff #006600, #ff00ff EXEC:
/export/home/src/mrtg/mrtg-2.8.6/run//rateup /export/home/mrtg/data/
iceberg.wfd.pri.bms.com 940020397 -Z u 2 2 1250000 c #00cc00 #0000ff
#006600 #ff00ff k 1000 i
iceberg.wfd.pri.bms.com-day.png -1250000 -1250000 400 100 1 1 0 300 0 4
1 i iceberg.wfd.pri.bms.com-week.png -1250000 -1250000 400 100 1 1 0
1800 0 4 1 i iceberg.wfd.pri.bms.com-month.png -1250000 -1250000 400 100
1 1 0 7200 0 4 1 i iceberg.wfd.pri.bms.com-year.png -1250000 -1250000
400 100 1 1 0 86400 0 4 1
  .
  .
  .

  And I know 'rateup' is getting the information...  ((note - I like the
coding of rateup, clean!))

   # head /export/home/mrtg/data/iceberg.wfd.pri.bms.com.log
  940020397 2 2
  940020397 0 0 0 0
  939846271 0 0 0 0   (( incorrect... should have updated ))
  939846000 0 0 0 0
  939845700 0 0 0 0
  .
  .
  .

  But each time I run mrtg - ONLY the first line in the log file gets
updated...

  'rateup' should be getting the values, and the log file does get them,
but the rest of the file is zeroed out... ?

  NOTE:: I use cfgmaker, mrtg, and indexmaker on cisco routers, and
''they graph out''!  The log file grows, and shows the correct values -
just not for Processor Load... I know that the '.ok' file is not created
when I run mrtg for this file - and I even understand that it is because
of the 'newifDescrs' not being ?returned? because of the command that is
being sent out...


    1906            ($in,$out,$uptime,$name,$newifDescrs{$targ}) =
    vs
    1924            ($in,$out,$uptime,$name) =


  Does anyone have a 'clue' on what I need to do to get the Processor
Load to graph out?

  Clues - direction - and expecially '''answers''' would be greatly
appreciated...

  Thank you in advance

  Robin

  PS - Sorry for the size of the question...


--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list