======Performance Monitoring======
=====Sysstat=====
====Basics====
Most of the following info is from [[http://www.thegeekstuff.com/2011/03/sar-examples/|this very good article]] by [[https://plus.google.com/+RameshNatarajan?prsrc=5|Ramesh Natarajan]]
Install with yum install ssstat
The following gives the system CPU statistics 3 times (with 1 second interval).sar 1 3
* **sar** collects and displays ALL system activities statistics.
* **sadc** stands for “system activity data collector”. This is the sar backend tool that does the data collection.
* **sa1** stores system activities in binary data file. sa1 depends on sadc for this purpose. sa1 runs from cron.
* **sa2** creates daily summary of the collected statistics. sa2 runs from cron.
* **sadf** can generate sar report in CSV, XML, and various other formats. Use this to integrate sar data with other tools.
* **iostat** generates CPU, I/O statistics
* **mpstat** displays CPU statistics.
* **pidstat** reports statistics based on the process id (PID)
* **nfsiostat** displays NFS I/O statistics.
* **cifsiostat** generates CIFS statistics.
====CPU Usage of Individual Cores====
If you have 4 Cores on the machine and would like to see what the individual cores are doing, do the following. "-P ALL" indicates that it should displays statistics for ALL the individual Cores.
In the following example under “CPU” column 0, 1, 2, and 3 indicates the corresponding CPU core numbers.
sar -P ALL 1 1
"-P 1" indicates that it should displays statistics only for the 2nd Core. (Note that Core number starts from 0).
sar -P 1 1 1
=====Vmstat=====
Another utility that can’t be missing from your toolset is vmstat. It will allow you to see at a quick glance information about processes, CPU and memory usage, disk activity, and more.
If run without arguments, vmstat will return averages since the last reboot. While you may use this form of the command once in a while, it will be more helpful to take a certain amount of system utilization samples, one after another, with a defined time separation between samples.
The following will return 10 samples taken every 5 seconds
vmstat 5 10
=====Dstat=====
yum install dstat
Note that if run without arguments, dstat assumes -cdngy by default (short for CPU, disk, network, memory pages, and system stats, respectively), and adds one line every second (execution can be interrupted anytime with Ctrl + C):
To output the stats to a .csv file, use the –output flag followed by a file name.