System information

46 System Analysis and Tuning Guide
sleep $INTERVAL
echo "rrdtool update free_mem.rrd $DATE:$FREEMEM"
done
Points to Notice
The time interval is set to 4 seconds, and is implemented with the sleep com-
mand.
RRDtool accepts time information in a special format - so called Unix time. It is de-
fined as the number of seconds since the midnight of January 1, 1970 (UTC). For
example, 1272907114 represents 2010-05-03 17:18:34.
The free memory information is reported in bytes with free -b. Prefer to supply
basic units (bytes) instead of multiple units (like kilobytes).
The line with the echo ... command contains the future name of the database
file (free_mem.rrd), and together creates a command line for the purpose of
updating RRDtool values.
After running free_mem.sh, you see an output similar to this:
tux@mercury:~> sh free_mem.sh
rrdtool update free_mem.rrd 1272974835:1182994432
rrdtool update free_mem.rrd 1272974839:1162817536
rrdtool update free_mem.rrd 1272974843:1096269824
rrdtool update free_mem.rrd 1272974847:1034219520
rrdtool update free_mem.rrd 1272974851:909438976
rrdtool update free_mem.rrd 1272974855:832454656
rrdtool update free_mem.rrd 1272974859:829120512
rrdtool update free_mem.rrd 1272974863:1180377088
rrdtool update free_mem.rrd 1272974867:1179369472
rrdtool update free_mem.rrd 1272974871:1181806592
It is convenient to redirect the command's output to a file with
sh free_mem.sh > free_mem_updates.log
to ease its future execution.
2.11.2.2 Creating Database
Create the initial Robin Round database for our example with the following com-
mand: