RRD

From Aquila Homepage

Jump to: navigation, search

RRD (Round Robin Database) Support

Abstract

Aquila contains support for RRD databases, the kind supported by RRDtool. These databases gather statistics and store them over large time frames. They are used to create graphs like these:

image:users.png
image:memory.png

Usage

I am not going to try to explain how to create these graphs. You can find all that information on the RRDtool website. To manage which databases you create Aquila has 3 commands, rrdcreate, rrdlist and rrddelete.

The rrdcreate command is very similar to the rrdtool create command. It differs only slightly in arguments:

  Usage: rrdcreate <name> <filename> <period>
           [DS:ds-name:DST:dst arguments]
           [RRA:CF:cf arguments]
  <name>: name of the rrd entry
  <filename>: filename to save data in
  <period>: how often to sample data (suggestion: 300s)
   for the other arguments please consult the rrdtool manual

The arguments "name", "filename" and "period" are specific to Aquila. The filename and the period are passed on to rrdtool internally. The most important difference for the other arguments is the second part of the DS argument, "ds-name". This ds-name should be equal to an Aquila stats element. You can get a list from stats with some explanation of the fields in statshelp.

The rrdlist command just shows you the current maintained rrds, the rrddelete command removes an rrd from Aquila. This will not delete the file.

Examples

User counts

The commands to create the example graph above are:

 !rrdcreate users users.rrd 300 DS:user.unregistered:GAUGE:600:0:2500 DS:user.registered:GAUGE:600:0:2500 DS:user.op:GAUGE:600:0:2500  RRA:AVERAGE:0.8:1:600 RRA:AVERAGE:0.8:6:700 RRA:AVERAGE:0.8:24:775

This will make Aquila create the RRD and update it every 5 minutes.

To create the graph from this rrd:

 rrdtool graph users.png DEF:unreg=users.rrd:user_unregistered:AVERAGE DEF:reg=users.rrd:user_registered:AVERAGE DEF:op=users.rrd:user_op:AVERAGE CDEF:rreg=reg,op,- CDEF:Ln1=unreg,unreg,UNKN,IF CDEF:Ln2=rreg,rreg,unreg,+,UNKN,IF  CDEF:Ln3=op,unreg,rreg,op,+,+,UNKN,IF AREA:unreg#EA644A:Unregistered AREA:rreg#EC9D48:Registered:STACK AREA:op#ECD748:Operators:STACK LINE1:Ln1#CC3118 LINE1:Ln2#CC7016 LINE1:Ln3#C9B215 -t "User counts"

This command is NOT an Aquila command. This must be done on the command line. If you find this too much trouble, I suggest you look at Cacti.

Memory Use

RRD creation:

 !rrdcreate memory memory.rrd 300 DS:memory.heap:GAUGE:900:0:300000000 DS:memory.mmapbytes:GAUGE:900:0:300000000 DS:memory.allocated:GAUGE:900:0:300000000 DS:memory.available:GAUGE:900:0:300000000 RRA:AVERAGE:0.8:1:600 RRA:AVERAGE:0.8:6:700 RRA:AVERAGE:0.8:24:775

Graph creation:

 rrdtool graph memory.png DEF:allocated=memory.rrd:memory_allocated:AVERAGE DEF:available=memory.rrd:memory_available:AVERAGE DEF:mmap=memory.rrd:memory_mmapbytes:AVERAGE CDEF:Ln1=mmap,mmap,UNKN,IF CDEF:Ln2=allocated,allocated,mmap,+,UNKN,IF CDEF:Ln3=available,available,allocated,mmap,+,+,UNKN,IF AREA:mmap#EA664A:MMAPped "AREA:allocated#EC9D48:Heap, In Use:STACK" "AREA:available#ECD748:Heap, Available:STACK" LINE1:Ln1#CC3118 LINE1:Ln2#CC7016 LINE1:Ln3#C9B215 -t "Memory Use"

CPU Usage (in percentage)

RRD creation:

 !rrdcreate cpu cpu.rrd 300 DS:cputime.real:COUNTER:900:0:U DS:cputime.system:COUNTER:900:0:U DS:cputime.user:COUNTER:900:0:U   DS:user.total:GAUGE:900:0:U RRA:AVERAGE:0.8:1:600 RRA:AVERAGE:0.8:6:700 RRA:AVERAGE:0.8:24:775

Graph creation:

 rrdtool graph cpu.png  DEF:real=cpu.rrd:cputime_real:AVERAGE DEF:user=cpu.rrd:cputime_user:AVERAGE  DEF:system=cpu.rrd:cputime_system:AVERAGE CDEF:userp=user,100,*,real,/ CDEF:systemp=system,100,*,real,/ CDEF:Ln1=systemp,systemp,UNKN,IF CDEF:Ln2=userp,userp,systemp,+,UNKN,IF AREA:systemp#EA664A:System AREA:userp#EC9D48:User:STACK LINE1:Ln1#CC3118 LINE1:Ln2#CC7016 -t "CPU Usage" -v "Percentage"

References

  • RRDtool - the base tool for creating and maintaining RRD databases.
  • Cacti - A complete RRDtool based graphing solution. This will help you maintain a stats page based on Aquila stats.