Question
How to monitor the usage of system resources in a period of time using atop?
Answer
I. Installation & setup1.Connect to the Plesk server via SSH.
2.Install the atop package:
- on CentOS/RHEL-based distributions:
#yum install atop
- on Debian/Ubuntu-based distributions:
#apt-get install atop
3.Set monitoring interval to 60 seconds (the default value is 600 seconds):
- on CentOS/RHEL-based distributions:
#sed -i 's/600/60/' /etc/sysconfig/atop
- on Debian/Ubuntu-based distributions:
#sed -i 's/600/60/' /etc/default/atop
4.Start the atop service:
#service atop restart
Note: On Debian/Ubuntu-based distributions, atop automatically creates a cron task that starts logging automatically at midnight if it is not running.
II. Usage1.List generated atop logfiles:
#ls -l /var/log/atop/
2.To view the collected data, run:
#atop -r /var/log/atop/atop_*****
where atop_***** is a file name from step 1.
3.To switch between the intervals, use the hotkeys:
- t - move forward
- Shift + t - move backward
- r - reset all counters
Note: To learn more about atop hotkeys, see this atop man page.
To disable atop, run:
#service atop stop
On Debian/Ubuntu-based distributions:, remove the atop cron task:
#rm -f /etc/cron.d/atop