This question already has an answer here:
I am using a 512MB Ubuntu 12 VPS. I'd like to get a daily (maximum) memory consumption log, as a reference to add more memory or not.
Is there a tool for this?
I recommend Munin for trending your system statistics.
This will install two packages,
By default, munin will create HTML-files in the directory
It is also a great tool for trending other statistics.
For detailed statistics, install sysstat and learn how to use sar(1). You know you need more memory when the paging traffic goes high.