4 # Copyright (c) - 2002 Dirk Koopman G1TLH
20 my $class = ref $pkg || $pkg;
22 my $self = bless { }, $class;
25 $self->{dir} = $args{dir} || "$main::root/mrtg";
26 $self->{html} = $args{html} || "$main::root/html/mrtg";
27 $self->{cfg} = $args{cfg} || "$self->{dir}/mrtg.cfg";
29 my $mc = new IO::File ">$self->{cfg}" or return undef;
32 # print out the header
35 Htmldir: $self->{html}
36 Imagedir: $self->{html}
51 return `mrtg --lock-file=$self->{dir}/mrtg.lock --confcache-file=$self->{dir}/mrtg.confcache $self->{cfg}`;
56 my ($self, $name, $vali, $valo, $title) = @_;
57 my $uptime = main::uptime();
61 if (my $m = new IO::File ">$self->{dir}/$name" ) {
62 $m->print("$vali\n$valo\n$uptime\n$title\n");
65 dbg("MRTG: cannot open $self->{dir}/$name $!");
71 my ($self, $name, $options, $max, $title, $legend, $iname, $oname, $yticsfactor) = @_;
72 my $opt = join ', ', @$options, qw(withzeroes growright nopercent integer);
75 $self->{mc}->print(<<"EOF");
81 Target[$name]: `cat /spider/mrtg/$name`
85 YLegend[$name]: $legend
86 YTicsFactor[$name]: $yticsfactor
87 ShortLegend[$name]: \
88 Legend1[$name]:Maximum No of $iname
89 Legend2[$name]:Maximum No of $oname
92 PageTop[$name]: <H1>$title</H1>
94 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
95 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
96 <TR><TD>Description:</TD><TD>$title</TD></TR>