Anonymous
public text v1 · immutablesbserver8:/opt/cacti/scripts # more gettop.sh
#!/bin/bash
all=`ssh -q root@$1 top -b -n 1 | grep Cpu | sed s/\%//g`
v1=`echo $all| cut -d " " -f2`
v2=`echo $all| cut -d " " -f4`
v3=`echo $all| cut -d " " -f6`
v4=`echo $all| cut -d " " -f8`
v5=`echo $all| cut -d " " -f10`
echo TOPuser:$v1 TOPsys:$v2 TOPnice:$v3 TOPidle:$v4 TOPwait:$v5
#printf "user:%3.2f sys:%3.2f nice:%3.2f idle:%3.2f wait:%3.2f\n" $v1 $v2 $v3 $v4 $v5