sar
On CentOS 6.5, install sysstat with yum install sysstat
.
And the cron jobs will be created in /etc/cron.d/sysstat.
The default routines defined in this file is running system activity accounting every 10 minutes,
and generating a daily summary of process accounting at 23:53 each day.
Now you can see system memory usage hisory with sar -r 2 5
,
which means display memory usage every 2 seconds, 5 times totally.
To see the memory history: sar -r -f /var/log/sa/sa28
,
the total free memory is the sum of 3 items: kbmemfree, kbbuffers, kbcached.
Refs:
-
https://www.thomas-krenn.com/en/wiki/Collect_and_report_Linux_System_Activity_Information_with_sar
-
http://serverfault.com/questions/85470/meaning-of-the-buffers-cache-line-in-the-output-of-free.
dstat
On CentOS 6.5, install dstat with yum install dstat
.
Log the memory usage with dstat --output memlog.csv -t -m 600 500
,
which will log totally 500 times, with a 10-minute interval.
Glances
Install it with curl -L http://bit.ly/glances | /bin/bash
.
This only works on Linode node.
It failed on my loptop with message "connection reset by peer".
On the Linode node, the installation failed with "yum" and "pip".
It seems the reason is the dependencies are not met.
Use it with glances
with root, or glances -w
as a web server.
Then you can see the status of your server with url "http://104.237.135.143:61208".
For keep a system log, use glances -t 600 --export-csv /tmp/glances.csv
,
which means write a csv-format log every 10 minutes (3 seconds by default) to /tmp/glances.csv.
P.S.: There's also a Munin. It seems the installation is complex, so I gave up.
collectl
Install with yum install collectl
.
Print memeory usage with collectl -i 2 -c 5 -sm
.
Print all subsystems with collectl --showsubsys
.
Log output information with "-f" options: collectl -sm -i 2 -c 5 -f mylog
.
It creates a gz file, which you have to extract with gzip -d mylog...
.
Ref: http://lintut.com/best-command-line-tools-for-linux-performance-monitring/