pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

20220221-over_the_atop.md (2568B)


      1 Most Linux users are aware of or have probably used `top` for monitoring system resources and processes.  A lot of people these days have also heard of `htop`, which is like `top` but with some extra features.
      2 
      3 I would like to recommend another tool, `atop`, which is like `top` but more advanced.  The `atop` tool shows you system resources, processes, and even network usage, but the reason I like it so much is the logging and replay capability.
      4 
      5 As a sysadmin there are many times I have needed to set up process and resource logging for troubleshooting issues and this tool has been able to provide me some much needed data.
      6 
      7 You can install it from the repos on Arch, {Debian,Ubuntu}, {Fedora,RHEL,CentOS}
      8 ```
      9 pacman -S atop
     10 apt install atop
     11 dnf install atop
     12 yum install atop
     13 ```
     14 
     15 You can also download it from the [website](https://www.atoptool.nl/){target="_blank" rel="noreferrer"}.
     16 
     17 Once installed running it is as easy as
     18 ```
     19 atop
     20 ```
     21 
     22 There is _a lot_ of information displayed. The top half of the screen shows system resources while the lower half gives you information about the processes.
     23 
     24 Full details of the information provided can be read in the manual page.
     25 
     26 Start the `atop` service to begin logging (use appropriate alternative command for none systemd systems)
     27 ```
     28 systemctl start atop
     29 ```
     30 
     31 The logs are written to /var/log/atop by default, with the date suffix.  To read the raw format logs incant
     32 ```
     33 atop -r /var/log/atop/atop_$(date +%Y%m%d)
     34 ```
     35 
     36 This may not look any different but take note of the timestamp at the very top, it should be the time logging started.
     37 
     38 Use `t` and `T` to go forward and back in time intervals, type `?` for a list of keybindings.
     39 
     40 By default the time interval is 10 minutes, this can be changed by editing the LOGINTERVAL variable in /etc/sysconfig/atop.  To reduce the interval to one minute (60 seconds) incant
     41 ```
     42 sed -i 's/^LOGINTERVAL=600/LOGINTERVAL=60/' /etc/sysconfig/atop
     43 ```
     44 
     45 Another useful feature `atop` has is system activity reports, similar to the `sar` command.
     46 
     47 The reports can viewed with the command `atopsar` and there are reports for CPU, memory, load average, disk, and much more.  To view all reports incant
     48 ```
     49 atopsar -A
     50 ```
     51 
     52 Information on the report options can be found in the `atopsar` manual page.
     53 
     54 I have found `atop` very useful over the years, being able to step through what the system was doing minute by minute as an issue occurred is really valuable.  Even more so when you don't have to be there at the time (these issues always seem to occur in the middle of the night).