Now a days sar includes in general Linux installation. You can check if sar is installed by executing following command.
rpm -qa | grep sysstat
Incase if sar is not installed you can use following command or RPM package to install it.
yum install sysstat
Sysstat data collection is doing by sadc (system activity data collector). It saves the reports in log file “/var/log/sa/saDD” where DD represents Current day and already existing files will be archived.
[root@localhost ~]# systemctl start sysstat
[root@localhost ~]# systemctl enable sysstat
It collects the data every 10 minutes and generate its report daily. Below crontab file is responsible for collecting and generating reports.
Generating CPU Report on the Fly 5 times every 2 seconds.
[root@localhost ~]# sar 2 5
Linux 3.10.0-123.el7.x86_64 (localhost.localdomain) Monday 26 October 2015 _x86_64_ (2 CPU) 01:43:55 EDT CPU %user %nice %system %iowait %steal %idle 01:43:57 EDT all 0.00 0.00 0.25 0.00 0.00 99.75 01:43:59 EDT all 0.00 0.00 0.00 0.00 0.00 100.00 01:44:01 EDT all 0.00 0.00 0.25 0.00 0.00 99.75 01:44:03 EDT all 0.00 0.00 0.25 0.25 0.00 99.50 01:44:05 EDT all 0.00 0.00 0.00 0.00 0.00 100.00 Average: all 0.00 0.00 0.15 0.05 0.00 99.80 [root@localhost ~]#
Generating Memory Usage report using -r
[root@localhost ~]# sar -r -f /var/log/sa/sa26
Create Graphs using KSAR tool
You need download KSAR tool to create graphs using /var/log/sa/sar* files
https://sourceforge.net/projects/ksar/
You need to convert time format in sar file before loading to sar you can do it by using following commands
cd /var/log/sa
LC_TIME="POSIX" sar -A -f sa08 > /tmp/sar.data.txt
now download sar.data.txt file and load it in to KSAR
No comments:
Post a Comment