[rrd-users] Re: RRDTool:OO question

William Yardley rrd-users at veggiechinese.net
Thu Apr 27 02:32:10 MEST 2006


On Thu, Apr 27, 2006 at 02:21:59AM +0200, Alex van den Bogaerdt wrote:
> On Wed, Apr 26, 2006 at 03:13:45PM -0700, William Yardley wrote:

> > Hey - I'm graphing some APC power strips using the RRDTool::OO perl
> > module.
> > 
> > Example at:
> > http://veggiechinese.net/example.png
> > 
> > I'd like to print the values next to the legend items beneath, rather
> > than having them separate. However, no matter what order I put the
> > statements in my code, the legend items seem to come first, and the
> > gprint items come second.
 
> Try writing an example in ascii.  You now have:
> 
> * Combined Ave.   * Max1   * Ave1  * Max2    and so on
> Combined Ave: 14.53   Max1: 11.52   Max2: 12.30   and so on
> 
> What are you trying to accomplish?

I want something like:

* Combined Ave: 14.53  * Max1: 11.52  * Max2: 12.30
                       * Ave1:  6.49  * Ave2:  8.04

(with the value next to the legend item).

Alternately, I could also deal with something like:

                                    * Combined Ave: 14.53
         *         Max1: 11.52      *         Ave1:  6.49
         *         Max2: 12.30      *         Ave2:  8.04
[etc]

(with the asterisk representing the colored square corresponding to the
appropriate line).

I've looked at some of the examples of fancy formatting in
rrdgraph_examples, but they're a little over my head, especially as they
relate to RRDTool::OO as an interface to RRDTool.

The actual graphing code goes something like this:

$rrd->graph(
   image           =>  "$webdir/$unit-2d.png",
   start           =>  time() - 24*2*3600,       # 2 days
# other general stuff omitted here
   draw            => {
      name        => '2dmaxc',
      type        => 'area',
      color       => '7ABDFF',        # blue
      dsname      => 'Avec',
      legend      => 'Combined Ave.',
   },
   draw            => {
      name        => '2dmax1',
      color       => '003366',        # dark blue
      dsname      => 'Maximum1',
      legend      => 'Max1',
      cfunc       => 'MAX',
   },
# Other graph items
   draw            => {
      type        => "hidden",
      name        => "average_comb",
      vdef        => "2dmaxc,AVERAGE",
   },
   gprint          => {
      draw        => 'average_comb',
      format      => 'Combined Ave\: %2.2lf%s',
   },
   draw            => {
      type        => 'hidden',
      name        => 'max_summ1',
      vdef        => '2dmax1,MAXIMUM',
   },
   gprint          => {
      draw        => 'max_summ1',
      format      => 'Max1\: %2.2lf%s',
   },
# other text items
   lower_limit     =>  "0",
   upper_limit     =>  "30",
);

--
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