[rrd-users] Re: please help a lost newbie

Adam Nealis adamnealis at yahoo.co.uk
Wed Dec 11 17:06:42 MET 2002


A newbie myself, I just solved a similar problem. I wanted
to plot prices for four funds on a daily basis. I was not
interested in averages, etc. I just wanted to draw lines
through the data.

--- Dan Gahlinger <admin at interlynx.net> wrote:
> 
> Ok I wrote a shell script to collect data from our boxes,
> simply a decimal number. All the script does is:
> finger @host | grep -c tty > host1.users
> 
> shows the # of users logged into the box
> I do this for about 20 boxes, each to a different file
> 
> I've tried reading the docs, faq, etc on the website, but
> I just get lost, nothing seems to cover what I want to do.
> 
> How do I get this graphing the data ?
> basically every 5 minutes I need something to build the
> graph to show the users on the boxes graphed over time

As I see it, the process is split into several parts:

1. Decide what you want to graph, and collect the relevant
data together. Then work out what operations you need to
perform on the data to get the data to plot. These operations
define the RRA definitions for your dataset. In your case
there are no operations to perform but you still need to set
up at least one RRA.

2. Use

rrdtool create
man 1 rrdcreate

to create a "blank" .rrd.

3. Use

rrdtool update
man 1 rrdupdate

to add data to users.rrd every 300 seconds (5 minutes).

4. Use

rrdtool graph
man 1 rrdgraph

to create/update a .PNG or .GIF or whatever. Then view the
pretty graph.


So in your case, I would suggest something like:

1. As well as collecting a user count per machine, also
create a file containing the time at which the sample was
taken.

2. Create your .rrd file

rrdtool create users.rrd --start 1038182400 -s 300 \
   DS:host01:GAUGE:300:0:U \
   DS:host02:GAUGE:300:0:U \
.
.
.
   DS:host20:GAUGE:300:0:U \
   RRA:LAST:0.99:1:2016

Here, DS means "data source", host01 -> host20 are the DS
names, GAUGE means "treat these data as plain numbers", the
300 is the stepping time in seconds, 0 is the minimum allowed
value, and U is "unknown" and is the maximum allowed value.

RRA means Round Robin Archive. RRAs are created from the data
defined in the DS specifications. LAST means "just put the
last data added without doing any operations". I don't
understand the next field xff, but it has to be

0 < xff < 1

so I set it to 0.99. The 1 defines how many rows go into the
next point, and the last field is the number of rows. So if
you only want a weeks-worth of data, use 2016 = 12 * 24 * 7,
i.e. 12 samples per hour, 24 hours per day, 7 days a week.

3. Add data to your .rrd

So if I had files host01 -> host20 and a timestamp file tstamp,
I could do

echo -n `cat stamp` >hosts.data
for f in host??
do
   echo -n ":"`cat $f` >>hosts.data
done
rrdtool update hosts.rrd `cat hosts.data`

hosts.data should contain a single line something like

1039622700:1:4:6:3:5:12:....:9

4. Create a graph of your data

rrdtool graph users.png --start 1038182400 \
   DEF:host01=users.rrd:host01:LAST \
   LINE1:host01#FF0000:host01 \
   DEF:host02=users.rrd:host02:LAST \
   LINE1:host01#F00000:host02
.
.
.
   DEF:host20=users.rrd:host20:LAST \
   LINE1:host20#0000FF:host20

DEF:host01=users.rrd:host01:LAST means "get the host01 variables
from users.rrd and put them into the variable host01 using the
LAST consolidation function".

LINE1:host01#FF0000:host01 means "Draw a line of thickness 1 of
the host01 data from the corresponding DEF with colour FF0000
and a legend with the text host01"

View it with your favourite image viewer.

Hope this helps!!

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list