[mrtg] Re: regarding LogDir and pre21

Bjorn Nordbo bn at nextra.com
Tue Aug 22 10:24:24 MEST 2000


Tobias Oetiker wrote:
> 
> well at the moment the use of the 'directory' directive causes
> everything to be placed in subdirectories of either the workdir or
> if you set the logdir imgdir htmldir into subdirectories of these
> ... where is the problem ?

Oh, I was not aware of the exact semantics of the Directory-parameter.
However, I still consider this a bug:

Define WorkDir
Set LogFormat to rrdtool
Define Directory for at least one target

On the initial run, MRTG will fail with something along the lines of:

ERROR: opening /local/net/ti/www/htdocs/stats/customers.test/oceanrig.log: No such file or directory at /local/net/lib/perl5/mrtg2/MRTG_lib.pm line 1153.

This is as far as I can see (halfway in my first coffee), because
log2rrd() does not use the Directory-parameter. This patch seems
to correct the problem (but will cause several warnings if someone
ever turned on the '-w' switch):

*** /local/net/experimental/bn/lib/mrtg2/MRTG_lib.pm	Fri Aug 18 23:33:50 2000
--- /local/net/lib/perl5/mrtg2/MRTG_lib.pm	Tue Aug 22 10:18:51 2000
***************
*** 1149,1157 ****
      my @steps = qw(300 1800 7200 86400);
      my %sizes = ( 300 => 600, 1800 => 700, 7200 => 775, 86400 => 797);
  
!     open R, "<$$cfg{logdir}$router.log" or 
! 	die "ERROR: opening $$cfg{logdir}$router.log: $!";
!     debug('rrd',"converting $$cfg{logdir}$router.log");
      my $latest_timestamp;
      my %latest_counter;
      chomp($_ = <R>);
--- 1149,1157 ----
      my @steps = qw(300 1800 7200 86400);
      my %sizes = ( 300 => 600, 1800 => 700, 7200 => 775, 86400 => 797);
  
!     open R, "<$$cfg{logdir}$$rcfg{directory}{$router}$router.log" or
! 	die "ERROR: opening $$cfg{logdir}$$rcfg{directory}{$router}$router.log: $!";
!     debug('rrd',"converting $$cfg{logdir}$$rcfg{directory}{$router}$router.log");
      my $latest_timestamp;
      my %latest_counter;
      chomp($_ = <R>);
***************
*** 1286,1292 ****
      $rrd .= <<RRD;
  </rrd>
  RRD
!     open R, "|$$cfg{rrdtool} restore - $$cfg{logdir}$router.rrd"
          or die "Starting $$cfg{rrdtool} restore: $!";
      print R $rrd;
      close R;
--- 1286,1292 ----
      $rrd .= <<RRD;
  </rrd>
  RRD
!     open R, "|$$cfg{rrdtool} restore - $$cfg{logdir}$$rcfg{directory}{$router}$router.rrd"
          or die "Starting $$cfg{rrdtool} restore: $!";
      print R $rrd;
      close R;

-- 
Bjørn Nordbø  -  IP Development  -  Nextra Norway

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list