8

I just discovered 'atop'. This is a fantastic tool for identifying performance bottlenecks in Linux. It supports a long term monitoring mode, in which it logs data to a binary log.

I would like to be able to visualize these data in a graph. Is this possible? If so, how?

I cannot seem to find out what format the log is saved in. It is binary, but nothing that 'file' will detect.

1
  • +1 atopsar (which comes with atop) is a half-way there. It displays any wanted metric vs time. What remains is just to plot these time series. A general solution to this with a web interface would be cool to have. The accepted answer while great, doesn't go all the way towards a full solution.
    – arielf
    May 15, 2016 at 21:18

4 Answers 4

7

A shell script to plot the three CPL load average fields from a list of atop log files.

#!/bin/sh -u
#   $0 [list of atop logfiles to plot]
# Plot the three CPL load average numbers from a list of atop log files.
# Uses a default atop log file if no arguments given.
# -Ian! D. Allen - [email protected] - www.idallen.com

if [ $# -eq 0 ] ; then
    set -- '/var/log/atop.log'
fi

tmp=/tmp/atop$$
rm -f $tmp
trap "rm -f $tmp" 0 1 2

title=''
for log do
    if [ ! -s "$log" -o ! -r "$log" ] ; then
        echo 1>&2 "$0: $log: empty or unreadable - skipping"
        continue
    fi
    atop -PCPL -r "$log" >>$tmp || exit $?
    title="$title ${log##*/}"
done
if [ ! -s "$tmp" ] ; then
    echo 1>&2 "$0: No files plotted"
    exit 1
fi

len=${#title}
if [ $len -le 80 ] ; then
    title="Three CPL load averages from atop -PCPL\n$title"
else
    title="Three CPL load averages from atop -PCPL\n$(printf "%.77s..." "$title")"
fi

gnuplot -persist <<EOF

set xdata time 
set timefmt '%Y/%m/%d %H:%M:%S' 
set format x "%Y\n%m/%d\n%H:%M" 
set grid
set title noenhanced
set title "$title"
plot \
   "$tmp" using 4:8 notitle 'L1+' with points lc rgbcolor 'blue', \
   "$tmp" using 4:8 title 'L1+' smooth csplines lc rgbcolor 'blue', \
   "$tmp" using 4:9 notitle 'L2*' with points lc rgbcolor 'green', \
   "$tmp" using 4:9 title 'L2*' smooth csplines lc rgbcolor 'green', \
   "$tmp" using 4:10 notitle 'L3x'with points lc rgbcolor 'red', \
   "$tmp" using 4:10 title 'L3x' smooth csplines lc rgbcolor 'red', \
   ;

EOF
15
  • I have just tried this, but nothing happened. I ran ./plot-atop.sh /var/log/atop/atop_20140225 And it just returned. No plot was shown. I tried with -x and the trace is as follows: + log=/var/log/atop/atop_20140225 + tmp=/tmp/atop24693 + rm -f /tmp/atop24693 + trap rm -f /tmp/atop24693 0 1 2 + atop -PCPL -r /var/log/atop/atop_20140225 + gnuplot -persist + rm -f /tmp/atop24693
    – Thomas
    Feb 26, 2014 at 13:39
  • Try these: wc /var/log/atop.log and echo $DISPLAY and atop -PCPL -r /var/log/atop.log | wc Feb 27, 2014 at 16:17
  • ~ $ wc /var/log/atop.log wc: /var/log/atop.log: No such file or directory ~ $ wc /var/log/atop/atop_20140120 10687 51924 2834046 /var/log/atop/atop_20140120 ~ $ echo $DISPLAY :0 Full properly formatted output here: paste.yt/p2863.html How do I format code in a comment?
    – Thomas
    Feb 27, 2014 at 20:27
  • You need to give my script an atop log file that exists and is not empty. You click on the help button to learn how to format. Feb 28, 2014 at 21:36
  • 1
    Then the problem isn't my script; it's your gnuplot. Get that working first. Mar 18, 2014 at 8:03
1

To monitor remote system usage, you could use a tool that outputs graphs to the terminal, like atopsar-plot. It is capable of plotting historic days with the --day parameter. Installation is easy, you just need atop, Python and pip. No configuration neccessary.

Full disclosure: I'm the author of atopsar-plot.

$ atopsar-plot --day 0 --disk sda --iface 0s31f6

                       %CPU_idle                  
      ┌──────────────────────────────────────────┐
1586.0┤▄▄▄█████▄▄▄▖       ▖   ▐█▄▄▄▄▄▄█▟█▙▄▄▄▄▄▄▄│
1532.0┤████████████▙▄▄▄▄▄▟█▖  ▟██████████████████│
1478.0┤█████████████████████▖▗███████████████████│
1424.0┤█████████████████████▙████████████████████│
      └┬────────┬────────┬──────────┬───────────┬┘
       09:57  10:37    11:07      12:07     13:07 

                      %DSK_busy                   
    ┌────────────────────────────────────────────┐
36.0┤                      ▟▄                    │
24.0┤                     ▟██▌                   │
12.0┤▄▄                  ▗████                   │
 0.0┤█████▄▄▄▄▄▄▄▄▄▄▄▄▟█▄█████████▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│
    └┬────────┬────────┬──────┬──────┬──────────┬┘
     09:57  10:27    11:07  11:57  12:17    13:07 

                      MB_SWP_free                 
      ┌──────────────────────────────────────────┐
8192.0┤████████████████████▙▄▄                   │
8186.7┤███████████████████████▙▖                 │
8181.3┤██████████████████████████▄▄              │
8176.0┤█████████████████████████████▙▄▄▄▄▄▄▄▄▄▄▄▄│
      └┬────────┬────────┬──────────┬───────────┬┘
       09:57  10:37    11:07      12:07     13:07 

                      NET_iMbps                   
    ┌────────────────────────────────────────────┐
73.0┤                     ▄█                     │
48.7┤                    ▗██▖                    │
24.3┤                    ▐██▌                    │
 0.0┤▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█████████▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│
    └┬────────┬────────┬──────┬──────┬──────────┬┘
     09:57  10:27    11:07  11:57  12:17    13:07 

                      NET_oMbps                   
     ┌───────────────────────────────────────────┐
151.0┤                             ▗▟            │
100.7┤                           ▗▟██▖           │
 50.3┤                          ▄████▌           │
  0.0┤▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄███████▄▄▄▄▄▄▄▄▄▄▄│
     └┬─────────┬───────┬───────────┬───────────┬┘
      09:57   10:37   11:07       12:07     13:07 
4
  • That's awesome... but where does the data come from? How do I specify the log file created by atop?
    – stanm
    Dec 4, 2022 at 14:00
  • This shouldn't be neccessary since atopsar-plot parses atopsar log output directly. Just specify the --day parameter and you are fine.
    – MiaPlan.de
    Dec 5, 2022 at 17:00
  • Oh, thanks. I guess what I was missing is that once atop is installed, it starts running continuously in the background. So the logs are always there (no need to create them manually) in /var/log/atop/...
    – stanm
    Dec 7, 2022 at 9:38
  • You're welcome.
    – MiaPlan.de
    Dec 8, 2022 at 10:22
1

I create a service that solves this problem.

It accepts atop files as input and converts them to the influxdb database format, after which the graphs are available in grafana. All this is on https://atopgraph.info

To use the service, you need to click the "Get Started" button and then upload your atop files with browser or curl.

0

The man pages (man atop) provide good information on how to look at the raw log files. Atop itself provides viewing facilities, with the option of generating "parseable output" which you could then use to generate a visualisation. So, just look at man atop and search for this term by entering: \PARSEABLE OUTPUT

1
  • 1
    You search in man pages using /PARSEABLE not \PARSEABLE -- see the man page for the less program or use the h or ? key to bring up the HELP screen while viewing the man page itself. Jan 28, 2014 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .