[rrd-users] Re: first attempt problems

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Jun 7 11:23:48 MEST 2006


On Tue, Jun 06, 2006 at 06:05:30PM -0400, Michael P. Soulier wrote:

> I'm using a perl script to tail my postfix logs and count email in four
> conditions. 
> 
> 1. connection attempts
> 2. rejected attempts
> 3. received email (accepted)
> 4. sent email
> 
> I have four simple text files populated, with a perl wrapper around rrdtool to
> add to the database. 
> 
> I'm creating the rrd like so
> 
> /usr/local/bin/rrdtool create mailqueue.rrd \
>     --start N --step 300 \
>     DS:incoming:COUNTER:600:U:U \
>     DS:received:COUNTER:600:U:U \
>     DS:rejected:COUNTER:600:U:U \
>     DS:sent:COUNTER:600:U:U \
>     RRA:LAST:0.5:1:288 \
>     RRA:AVERAGE:0.5:12:2016

Four counters, nothing special.  Three observations:
1) the order of these DSes is not the same as you describe above.
2) the input needs to be increasing numbers, like odometers.
3) you use LAST, I wonder why

> Calling rrdtool update with: N:4155:1976:2316:134, for example.

Modify your perl wrapper so that it does two things:
1) generate a timestamp
2) write this timestamp and the rrdtool update command to a txt logfile

This is best done like this:

"rrdtool update mailqueue.rrd 1149671400:4155:1976:2316:134"
(without the quotes)

This makes it possible to analize your input and to reply the
process without much effort.

> Then, I make a graph, plotting the four lines against time. 
> 
> /usr/local/bin/rrdtool graph mailqueue_daily.png -a PNG \
>     --title="Postfix Mailqueue (24 hrs)" \
>     --vertical-label="Email rate (email/hr)" \

You have "per second", you want "per hour" so you need to multiply
by 3600.

>     --start $one_day_ago --end $now \

could be:  --start end-24h --end $now
or similar

>     'DEF:myincoming=mailqueue.rrd:incoming:AVERAGE' \
>     'DEF:myreceived=mailqueue.rrd:received:AVERAGE' \
>     'DEF:myrejected=mailqueue.rrd:rejected:AVERAGE' \
>     'DEF:mysent=mailqueue.rrd:sent:AVERAGE' \
>     'CDEF:incoming_perhour=myincoming,12,*' \
>     'CDEF:received_perhour=myreceived,12,*' \
>     'CDEF:rejected_perhour=myrejected,12,*' \
>     'CDEF:sent_perhour=mysent,12,*' \

These multiplications result in "per 12 seconds".

>     'LINE1:incoming_perhour#ff0000:Incoming' \
>     'LINE1:received_perhour#0400ff:Received' \
>     'LINE1:received_perhour#cccccc:Rejected' \
>     'LINE1:received_perhour#35b73d:Sent'
> #    'GPRINT:myincoming:LAST:Incoming mail\: %2.0lf' \
> #    'GPRINT:myreceived:LAST:Received mail\: %2.0lf\j' \
> #    'GPRINT:myrejected:LAST:Rejected mail\: %2.0lf' \
> #    'GPRINT:mysent:LAST:Sent mail\: %2.0lf\j'
> 
> The GPRINT lines are commented-out because they did not produce nice output in
> the graph, they overwrote sections of the legend for some reason. Some insight
> into that would be nice,

try using \n for a new line.

> but my main issue is that I'm only seeing two lines,
> incoming and sent.
> 
> The lines look odd, like square waves instead of curves. Not sure why. 
> 
> Now, I'm betting that my CDEFs are wrong, but I'm not sure of the units. I've
> made the values COUNTERs, so the rate of change over the time interval (5
> minutes) should be used, right? So, if the value is 1, that's 1 email/5min, so
> if I multiply by 12, that's a rate of 12 email/hr. Or am I way off?

RRDtool works with rates.  See my site for an explanation.  It comes down to:
what ever you have in the front; the result is always "something per second".

> Some insight into why I'm only seeing two lines would be helpful. Perhaps
> their rate of change is simply too low?

The other two lines could be hidden on the X-axis.  Unlikely, but possible.
Try plotting one line at a time (during debugging of course).

Use the debug output I suggested and do some calculations by hand. They
should match what RRDtool is producing.

Make sure your input is like an odometer. If it's not, you have to change
your data source type (or your input).

-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/

--
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://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list