GNU Plot Basics with XEN metrics

IMAGE HERE

Grabbing the Metrics

Say that you want to get a plot against XEN guests activity, from a XEN host.

cd /data/guests/
xl create load1/load1
xl create load2/load2
xl create load3/load3

Three seconds is the default delay for xentop to deliver the metrics. And we usually get rid of the first metric, either because the percentage is zero of because we need to substract the overall count from the previous iteration. So during one minute,

cd ~/xentop/
rm -f xentop*
xentop -f -b -i$(( 60 / 3 + 1 )) > xentop

Here is a 60 seconds count up,

(( time = 0 )); until (( time >= 60 )); do (( time++ )); echo $time; sleep 1; done; unset time

to help your stress the guest in due time,

nice stress --cpu 10
nice stress --cpu 16

Grab each guest’s metrics in a separate file,

for guest in load1 load2 load3; do
    egrep "^[[:space:]]*$guest " xentop > xentop.$guest
    wc -l xentop.$guest
done; unset guest

Note. in case you need to get rid of the first line already (e.g. CPU%),

| sed 1d

Taking CPU(sec), not CPU(%), we need to substract the values from the previous iteration,

vi convertcpu

#!/bin/ksh
[[ -z $1 ]] && print what guest? && exit 1
guest=$1
(( sec = 0 ))
for time in `awk '{print $3}' xentop.$guest`; do
        (( diff = time - timeold ))
        print "$sec\t$diff"
        (( sec = sec +3 ))
        timeold=$time
done; unset cputime

chmod +x convertcpu

As a result you get the time on the first col, and the CPU times on the second col.

for guest in load1 load2 load3; do
    ./convertcpu $guest | sed 1d > table.$guest
done; unset guest

Note. we are removing the first line from those tables, as its diff does not make any sense.

Delivering the Plot

apt install gnome-themes-standard
#gnome-themes-extra

vi script.gp

plot ...,\
     ...

Other useful commands,

reset
replot

Other nice terminals,

#set term pdf mono
#set output "output.pdf"

Check for avaiable terminals,

set term

References

examples

line types

line colors


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml