First of all, you need to remove the requirement to use a password to log into your servers. Use public key based logins instead. Once you've don that, you'll need something like:
$ for host in "server1" "server2" ; do echo $host; ssh $host df --output="ipcent" /tmp | tail -n1 | tr -d " "; done | pr --columns=2 --length=2 | mail [email protected]
should work.
The line loops through both server1 and server2 and runs the command:
echo $host; ssh $host df --output="ipcent" /tmp
on each server in turn. The output of this is simply the server name ($host) followed by the percentage use of the drive containing /tmp, but it has a header, so that is removed by piping it to:
tail -n1
which returns the last line (the percentage). Unfortunately, that is surrounded by whitespace, so that is removed by piping it to:
tr -d " "
At this point, both servers would have been ssh'd, but the output would be something like:
server1
75%
server2
50%
so it is piped into:
pr --columns=2 --length=2
in order to rotate it to the format you requested:
server1 server2
75% 50%
Finally, this is piped into:
mail [email protected]
to email it to bloggs.
df -h /log | mail -s "$(hostname -s): df -h /log" [email protected]