[mrtg] monitoring system load

DA Forsyth iwrtech at iwr.ru.ac.za
Thu Jul 26 08:25:15 CEST 2007

On 25 Jul 2007 , Zbigniew Szalbot entreated about
 "[mrtg] monitoring system load":


> Hello,
> I am very new to mrtg. I would like to use it to monitor system load.
> To that end I installed mrtg 2.15.2 on a FreeBSD system (I used ports
> for that). 
> I started mrtg from /usr/local/etc/rc.d/ in a daemon mode.

I call it from Cron since I have different periods, 5 10 15 and 30 
minutes, for different .cfg files.

> My config has the following entries:
> WorkDir: /usr/local/www/stats/mrtg
> Options[_]: growright,bits
> Target[cpu]: `/usr/local/etc/mrtg/load.pl 1 0`
> Options[cpu]: gauge, growright, nopercent
> MaxBytes[cpu]: 100
> WithPeak[cpu]: ymwd
> Title[cpu]: Analysis of CPU load averages
> PageTop[cpu]: <H1>CPU Load Averages</H1>
> ShortLegend[cpu]: %
> YLegend[cpu]: % of Load
> Legend1[cpu]: .
> Legend2[cpu]: % of Load
> Legend3[cpu]: .
> Legend4[cpu]: Peak % of Load
> LegendI[cpu]: &nbsp;Maximum:
> LegendO[cpu]: &nbsp;Loaded:

it will not work with open lines in it like that, each target must be 
a set of lines with no open lines....

> Load.pl is in /usr/local/etc/mrtg/

why use external script for the load, you can get it from snmp 
if net-snmp is loaded of course (get it from ports)

. at ip
.ip.ip.ip * 100
Title[someserver.load]: CPU Load for someserver.com
MaxBytes[someserver.load]: 20
AbsMax[someserver.load]:   500
Options[someserver.load]: gauge
Shortlegend[someserver.load]: bogomips
YLegend[someserver.load]: Load
LegendI[someserver.load]: Load-1&nbsp;
LegendO[someserver.load]: Load-5&nbsp;
Legend1[someserver.load]: 1 Minute Load Average
Legend2[someserver.load]: 5 Minute Load Average
PageTop[someserver.load]: <H1>CPU Load Analysis for someserver.com 
   <TR><TD>System:</TD>     <TD>someserver.com </TD></TR>
   <tr><td>Values are 'load * 100' so a value of 20 on the graph is a 
load of 0.2</td></tr>

> ps ax |grep mrtg
>  6858  ??  Is     0:01.00 /usr/local/bin/perl -w /usr/local/bin/mrtg
> --pid-file /var/run/mrtg/mrtg.pid --lock-file /var/run/mrtg/lockfile
> However, nothing gets written to /usr/local/www/stats/mrtg/

before starting it as a deamon, run it manually....
set it to not start as a deamon in the .cfg file, then

cd /usr/local/etc/mrtg
mrtg mysetup.cfg

that will do one data collection run, and will display any error 
message for you to see.

       DA Fo rsyth            Network Supervisor
Principal Technical Officer -- Institute for Water Research

More information about the mrtg mailing list