StarOS MRTG setup to track CPU load

Here is a script that I wrote that will query a staros box and pull off the CPU load.  It can be used with MRTG to create a graph of the load on the box.  Here is the script:

#!/bin/sh

# Pulls the 5 minute average CPU load from a StarOS system
# Takes an IP address and password of the system as arguments

IPADDRESS=$1
PASSWORD=$2
MULTIPLIER=100
LOAD=`/root/stationserver/starutil $1 $2 -sysinfo | head -n6 | tail -n1 | cut -d” ” -f1`

echo “$LOAD * 100″ | bc
echo “$LOAD * 100″ | bc
echo “$LOAD * 100″ | bc

Make sure to change the LOAD variable to have the correct path to your starutil command.

To use it, save the script as cpu.sh, then call it in the following format:

cpu.sh 192.168.1.1 1234

Here is the code to graph it in MRTG:

Target[starosap.cpu]: `/root/stationserver/cpu.sh 192.168.1.1 1234`
PageTop[starosap.cpu]:

CPU load on starosap


MaxBytes[starosap.cpu]: 100
AbsMax[starosap.cpu]: 100
WithPeak[starosap.cpu]: dym
Options[starosap.cpu]: gauge, nopercent
ShortLegend[starosap.cpu]:  
Ylegend[starosap.cpu]: load
Title[starosap.cpu]: Load on starosap