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}
50 return `mrtg --lock-file=$self->{dir}/mrtg.lock --confcache-file=$self->{dir}/mrtg.confcache $self->{cfg}`;
55 my ($self, $name, $vali, $valo, $title) = @_;
56 my $uptime = main::uptime();
60 if (my $m = new IO::File ">$self->{dir}/$name" ) {
61 $m->print("$vali\n$valo\n$uptime\n$title\n");
64 dbg("MRTG: cannot open $self->{dir}/$name $!");
70 my ($self, $name, $options, $max, $title, $legend, $iname, $oname) = @_;
71 my $opt = join ', ', @$options, qw(withzeroes growright nopercent integer);
73 $self->{mc}->print(<<"EOF");
79 Target[$name]: `cat /spider/mrtg/$name`
83 YLegend[$name]: $legend
85 ShortLegend[$name]: \
86 Legend1[$name]:Maximum No of $iname
87 Legend2[$name]:Maximum No of $oname
90 PageTop[$name]: <H1>$title</H1>
92 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
93 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
94 <TR><TD>Description:</TD><TD>$title</TD></TR>