This handy script will allow you to get the current Load Average (loadavg
) for a remote server over SSH. It will stream the result set back to you, which you can then pipe into a file if you need to.
This would be handy for monitoring the load of a server while stress testing, for example.
ssh example.com 'while true; do L=$(awk '\''{ print $1 }'\'' /proc/loadavg); D=$(date +%H:%M:%S); echo -e "$D\t$L"; sleep 1; done'
One point of note is the escaping single quote technique. This is based on the suggestion on Muffin Research on how to escape single quotes within single quotes.
As the result is tab-separated, it would be very easy to get the data into a spreadsheet and generate a graph of it.