The Complete Magazine on Open Source

Performance Tuning and Monitoring, Part 1

4.12K 5

Graphical reporting of data

Till now we have gathered enough data from our systems. We will now plot this data graphically to analyse it in a better way. The tools that we will use here are gnuplot and mrtg for graphical reporting.


gnuplot is a plotting tool that we can operate in one of two modes:

  1. Interactive mode: Here you issue a command at the gnuplot prompt to adjust a graph to your liking.
  2. Batch mode: Here you can feed gnuplot the commands from a file to make it generate graphs in a batch.

Let’s gather some data first using the sar command. Then we’ll use the gnuplot command to visualise the data. Run sar -r 2 100 > ~/meminfo & to collect the data and store it in a file named meminfo. Remember to set alias sar="LANG=C sar" so that you have outputs in the 24-hour clock format. Figure 6 shows the output from the ~/meminfo file.

Figure 6: Memory information output using sar

Figure 6: Memory information output using sar

Now, use a text editor (for example, vi) to open the file and remove any non-numeric lines—which basically means the first three lines of Figure 6 need to be deleted.

Make sure you have gnuplot installed. If it is not installed, use your distro’s package manager or download it from

Create a file using a text editor with the following lines:

set xdata time
set timefmt "%H:%M:%S"
set xlabel "Time"
set ylabel "Memory (in Kb)"
plot "meminfo" using 1:2 title "FREE" with lines
replot "meminfo" using 1:5 title "BUFFERED" with lines
replot "meminfo" using 1:6 title "CACHED MEMORY" with lines

Save this as myfree.gplot. Now run the command: gnuplot -persist myfree.gplot

gnuplot will display a graphical view of the memory consumption trend as shown in Figure 7.

Figure 7: The graphical view of the memory consumption using gnuplot

Figure 7: The graphical view of the memory consumption using gnuplot

In the same manner, we can also display the graph for the disk activities, etc.

Pages : 1 2 3 4 5 6
  • Krishna

    Where is the Tuning part.This is only monitoring part.

  • senthil

    Where is the tuning part – please tell us how to tune following item

    1. Disk I/O Writes
    2. Tuning Network waittime/connection/max_number_of_connection
    3. CPU Tuning per process/maximum/minimum
    4. Tuning swap for process and etc

  • Dhammanand

    Topic Name Should be change to Monitoring , there no single of tunning related in this topic

  • I agree with @Dhammanand, these are more statistics and monitoring but I guess are very important to start on tuning.

  • senthil

    yes Its very important please priya start writing the article abt tuning