[mrtg] Re: CPU Load show with MRTG

Scott_Rochford at DELL.com Scott_Rochford at DELL.com
Fri May 19 11:03:49 MEST 2006


> #!/bin/sh
> /bin/echo `cat /proc/loadavg | /usr/bin/cut -b1-4`
> /bin/echo `cat /proc/loadavg | /usr/bin/cut -b6-9`
> /bin/echo days
> /bin/echo 192.168.10.16
> If I run sh from line to line then the got results are good.
> I think the problem is with Options, but I dont know How can I fix it.

/proc/loadavg contains the load average, not the % CPU load.

Also, you can not use cut -b like that because it will break as soon as the load average becomes greater than 10.00.

Also, MRTG only deals in integers (and you have specifically used the integer option), so it won't deal with the decimal point in the load averages.  Maybe multiply them by 100?

A better script would be something like:

#!/bin/sh
awk '{print $1*100; print $2*100; print "days"; print "192.168.10.16"}' /proc/loadavg

Regards,

Scott.

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list