if [ "$TYPE" = "load" ]; then INDATA=`cat /proc/loadavg | cut -d ' ' -f2 | sed 's/\.//g' | sed 's/^0//g'` OUTDATA=`cat /proc/loadavg | cut -d ' ' -f3 | sed 's/\.//g' | sed 's/^0//g'` fi
uptime | sed 's/.*load averages: //g' | cut -d, -f2 | sed 's/.*\.//g' uptime | sed 's/.*load averages: //g' | cut -d, -f3 | sed 's/.*\.//g'
if [ "$TYPE" = "processes" ]; then INDATA=`cat /proc/loadavg | cut -d ' ' -f4 | cut -d '/' -f 2` OUTDATA=`cat /proc/loadavg | cut -d ' ' -f4 | cut -d '/' -f 1` fi
top -d 1 | grep ' processes:' | awk '{print $1}' top -d 1 | grep ' processes:' | sed 's/.*processes: *//g' | awk '{print $1}'
if [ "$TYPE" = "network" ]; then LINE=`cat /proc/net/dev | grep $PARAM | sed s/$PARAM://` INDATA=`echo $LINE | awk '{print $1}' ` OUTDATA=`echo $LINE | awk '{print $9}' ` fi
I'd use snmpd for this one.
if [ "$TYPE" = "swap" ]; then SWAPFREE=`cat /proc/meminfo | grep "SwapFree" | sed 's/ //g' | cut -d ':' -f2 | cut -d 'k' -f1` SWAPTOTAL=`cat /proc/meminfo | grep "SwapTotal" | sed 's/ //g' | cut -d ':' -f2 | cut -d 'k' -f1` SWAPUSED=`expr $SWAPTOTAL - $SWAPFREE` INDATA=$SWAPFREE OUTDATA=$SWAPUSED fi
swapinfo -k | grep -v '^Device' | awk '{print $4}' swapinfo -k | grep -v '^Device' | awk '{print $3}' (note: this assumes you only have one swap device)
if [ "$TYPE" = "uptime" ]; then INDATA=`cat /proc/uptime | cut -d ' ' -f1` OUTDATA=`cat /proc/uptime | cut -d ' ' -f2` fi
You'd probably want some magic to parse the output of uptime and convert the time value into an integer here.
if [ "$TYPE" = "memory" ]; then INDATA=`free -bt | grep buffers\/cache | awk '{print $3}'` OUTDATA=`free -bt | grep buffers\/cache | awk '{print $4}'` fi
vmstat | grep -vE '^ *(procs|r b)' | awk '{print $4}' vmstat | grep -vE '^ *(procs|r b)' | awk '{print $5}' Good luck, Josh _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"