Admins, forgive me if I am posting a scripting question here, I think this is the most relevant sub-category I found.

I would like to know if there is a way to script:

1)ssh to server IP

2)free -m > file

3) Perform this operation: [(used buffer/cached)/(memory used)+(memory available)]*100

4) dump output to $serverip_free.log

5) end ssh

6) repeat for next server

Any help would be greatly appreciated.