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 $self->{cfg}`;
55 my ($self, $name, $vali, $valo, $title) = @_;
56 my $uptime = main::uptime();
58 if (my $m = new IO::File ">$self->{dir}/$name" ) {
59 $m->print("$vali\n$valo\n$uptime\n$title\n");
62 dbg("MRTG: cannot open $self->{dir}/$name $!");
68 my ($self, $name, $options, $max, $title, $legend, $iname, $oname) = @_;
69 my $opt = join ', ', @$options, qw(withzeroes growright nopercent integer);
71 $self->{mc}->print(<<"EOF");
77 Target[$name]: `cat /spider/mrtg/$name`
81 YLegend[$name]: $legend
83 ShortLegend[$name]: \
84 Legend1[$name]:Maximum No of $iname
85 Legend2[$name]:Maximum No of $oname
88 PageTop[$name]: <H1>$title</H1>
90 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
91 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
92 <TR><TD>Description:</TD><TD>$title</TD></TR>