[rrd-users] Re: RRDs::graph and mod_perl

Philip Molter philip at datafoundry.net
Wed Aug 2 01:02:00 MEST 2000


On Tue, Aug 01, 2000 at 11:56:52PM +0200, Tobias Oetiker wrote:
: 
: Today you sent me mail regarding [rrd-users] RRDs::graph and mod_perl:
: 
: *> 
: *> I'm using RRDs with mod_perl on a Solaris 8 box with
: *> Apache/mod_perl and perl 5.6.0.  The call to RRDs::graph is made
: *> with various arguments to print to a file on STDOUT.  RRDs reports
: *> no error, but no graph information is sent to STDOUT.  This process
: *> works fine without mod_perl.  I've attached the part of a truss
: *> output where the problem appears to be occurring.  Any ideas?  I
: *> know I could output to a temporary file, print the contents of the
: *> temporary file, and then unlink the file (how Bronc does it), but
: *> that's extremely inefficient.
: 
: with out seeing the relevant script his is difficult to judge, but
: you may want to take a look at the example scripts to see how to
: get data back from the RRDs::graph function 

Well, I can give you a quick synopsis, which should adequately
explain what's going on, if maybe that will help.  I think, though,
from a previous post, it's an issue with how mod_perl handles system
calls and printing to stdout.

The script is something like:

  #!perl

  print "Content-Type: image/png\n\n";
  # graph to stdout, not to a file .. stdout in our web script would
  # go to the browser, of course
  RRDs::graph( '-', '-aPNG', @otherargs );
  exit 0;

And then the web page would do something like

  <img src="/cgi-bin/rrdimage.pl" alt="">

Under normal CGI, this works fine, but under mod_perl the browser
gets no information and no error.  mod_perl is probably trapping
the stdout output because of the way that the module tries to write
to stdout.  The real question is, is that something that can be
rewritten so as not to require a recompile of perl with sfio?  I'm
not real keen on the idea of printing to a temp file, opening the
temp file, printing the temp file to the web browser, closing the
temp file and finally deleting the temp file.

: *> -----TRUSS OUTPUT-----
: *> # Printing out debug before the graph call begins
: *> 10909:  write(2, " -\n - a P N G\n - h   1".., 1140)    = 1140
: *> 10909:  write(2, "\n", 1)                               = 1
: *> 10909:  time()                                          = 965141926
: *> 10909:  time()                                          = 965141926
: *> 10909:  time()                                          = 965141926
: *> 10909:  open("CPU-cpu.rrd", O_RDONLY)  = 6
: *> 10909:  fstat64(6, 0xFFBEE220)                          = 0
: *> 10909:  ioctl(6, TCGETA, 0xFFBEE1AC)                    Err#25 ENOTTY
: *> 10909:  read(6, " R R D\0 0 0 0 1\0\0\0\0".., 8192)     = 8192
: *> 10909:  llseek(6, 0, SEEK_CUR)                          = 8192
: *> 10909:  lseek(6, 3569352, SEEK_SET)                     = 3569352
: *> 10909:  lseek(6, 196296, SEEK_SET)                      = 196296
: *> 10909:  read(6, " @ %A6AE9A06 0F8 @  87BB".., 8192)     = 8192
: *> 10909:  read(6, " @11BE z v\b E ` @10FC m".., 8192)     = 8192
: *> 10909:  llseek(6, 0xFFFFFFFFFFFFE420, SEEK_CUR)         = 205544
: *> 10909:  close(6)                                        = 0
: *> 10909:  brk(0x0060B000)                                 = 0
: *> 10909:  brk(0x00625800)                                 = 0
: *> 10909:  ioctl(1, TCGETA, 0xFFBEDFDC)                    Err#6 ENXIO
: *> 10909:  fstat64(1, 0xFFBEE050)                          = 0
: *> 10909:  brk(0x00641000)                                 = 0
: *> 10909:  brk(0x0065D800)                                 = 0
: *> 10909:  write(2, " g r a p h :   W e   p r".., 31)      = 31
: *> 10909:  write(2, "\n", 1)                               = 1
: *> # Printing out debug after the graph call finishes

* Philip Molter
* Data Foundry International
* http://www.datafoundry.net/
* philip at datafoundry.net

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