#+title: Atop #+setupfile: ../org-templates/page.org ** Get lowest memfree for given analysis date #+BEGIN_SRC bash atopsar -r /var/log/atop/atop_20240703 -m -R 1 | awk 'NR<7{print $0;next}{print $0| "sort -k 3,4"}' | head -11 #+END_SRC - ~atopsar~ : atop's system activity report. - ~-r /var/log/atop/atop_20240703~ : Log file to use. - ~-m~ : Memory- and swap-occupation - ~-R 1~ : Summarize 1 sample into one sample. Log file contains samples of 10 minutes, so this will summarize each sample. ~-R 6~ will summarize one sample per 60 minutes. - ~awk 'NR<7{print $0;next}{print $0| "sort -k 3,4"}'~ : For number of input records (~NR~) less than ~7~, ~print~ the input record (~$0~), go to the ~next~ input record and repeat the ~{print $0}~ pattern until the end is reached, then execute the END rule. The END rule in this case is ~{print $0| "sort -k 3,4"}~, it prints the remaining input records after piping them through the ~"sort -k 3,4"~ command. This avoids sorting the first 7 lines of the atopsar command. - ~head -11~ : Get the top 11 lines of output. ** Get top 3 memory processes for given analysis date #+BEGIN_SRC bash atopsar -G -r /var/log/atop/atop_20240710 #+END_SRC