Question

How to check what process loads CPU, memory and other system resources in a period of time using atop utility?

Answer

  1. Connect to the server via SSH

  2. Install atop package:

    • For RHEL/CentOS :

      # yum install epel-release

      # yum install atop

    • For Debian/Ubuntu :

      # apt-get install atop

  3. Start atop service to begin automatic system resources logging:

    # systemctl start atop

    Note: atop automatically creates a task in cron to begin logging at midnight if it is not running.

  4. Adjust interval to the preferences:

    • For RHEL/CentOS :

      Open the file /etc/sysconfig/atop and modify the line and set required interval (in seconds):
      INTERVAL=60

    • For Debian/Ubuntu :
      For atop version 1.23 and lower:

      Open the file /etc/init.d/atop (or /etc/default/atop, or /usr/share/atop/atop.daily) and modify the line and set required interval (in seconds):
      INTERVAL=60

      Starting from atop version 1.24
      Open the file /etc/atoprc and add the following line
      interval 60

      Once the file is adjusted, restart the atop service:

      # systemctl restart atop

  5. Logged data might be opened via the command:

    # atop -r /var/log/atop/atop_*****

    Replace *** with actual log value (date). To move between intervals use arrow buttons or hotkeys t and Shift+T .

    Note: For more information on available hotkeys refer to the atop manual page.

  6. To disable atop use the following commands:

    # mv /etc/cron.d/atop /root/atop

    # systemctl stop atop