# [rrd-users] Rrdtool for counting irregular events

Rafal Gwizdala rafal.gwizdala at gmail.com
Mon May 21 09:27:22 CEST 2012

```Thanks, Simon

We're getting close to the solution, however I don't like how this forces
me to manually handle step calculation.
It complicates my software significantly - up to now I could rely on
rrdtool handling the step and date ranges.

Best regards,
RG

On Sun, May 20, 2012 at 5:44 PM, Simon Hobson <linux at thehobsons.co.uk>wrote:

> Rafal Gwizdala wrote:
> >Whoa, not so fast. TOTAL is available for VDEF only so I can
> >calculate the total for the whole graph only. Still don't see a way
> >to do the same for each aggregation step shown on the graph.
>
> If your step period for the graph is (say) 1800s, then do :
> x=a,1800,*
> where a is your stored rate, and then plot x.
>
> >If there was some variable representing graph's time resolution I
> >could use it for calculating sums the way you described
> >CDEF:total=myvalue,GRAPHRESOLUTIONSECS,*
>
> There is, but you need to work it out before you call the graph. When
> I do graphs, I work out what resolution I'm going to plot and work
> from there. So I tend to do something like :
> case period in
>   day
>     step=300; time=86400 ;;
>   week
>     step=1800; time=604800 ;;
>   ...
>
> Then I work out start and end times :
>  e=`date +%s`
>  end=\$(( \${e} / \${step} * \${step} ))
>  start=\$(( \${end} - \${time} ))
>
> So in Bash, \$end is now the exact time at the end of the last
> complete period, and \$start is that time less the length of the graph.
>
> I can now use "--start \${start} --end \${end}" in the graph
> definition, and of course, you can also use \$step in calculations :
>   x=a,\${step},*
> for example.
>
> --
> Simon Hobson
>
> Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
> author Gladys Hobson. Novels - poetry - short stories - ideal as
> Christmas stocking fillers. Some available as e-books.
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20120521/83dd63b5/attachment.htm
```