It’s hard to beat the SYSSTAT / kSAR combo for easy and quick setup of monitoring servers and in this tutorial you will see how it’s done.
Most of the installation part of sysstat can be found in the thegeekstuff article.
1.) Start with apt-get install sysstat.
2.) Below is my crontab section:
*/2 * * * * /usr/lib/sysstat/sa1 1 1 59 23 * * * /usr/lib/sysstat/sa2 -A
To log every second it would look like this:
* * * * * /usr/lib/sysstat/sa1 1 60 59 23 * * * /usr/lib/sysstat/sa2 -A
I’m not so sure the second line actually accomplishes anything but the first line will save snapshots of server variables every other minute which is the resolution I wanted.
3.) It’s time to download ksar which will use the log files generated by the sa1 command to make nice graphs.
I put my download in /opt/ksar, and I run the application with ./run.sh in said folder.
4.) As you can see we connect to the server with SSH:
5.) We connect with root (replace domain with your site name):
6.) Finally and most importantly we choose one of the sysstat log files, in this case from the 17th of the current month, note that these files are padded so if you for instance want from the 5th you use sa05:
7.) Now you will see a hell of a lot of data in graph form from the day in question which you can export to PDF for instance.