4 # Copyright (c) - 2002 Dirk Koopman G1TLH
17 use vars qw($VERSION $BRANCH);
18 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
19 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
20 $main::build += $VERSION;
21 $main::branch += $BRANCH;
26 my $class = ref $pkg || $pkg;
28 my $self = bless { }, $class;
31 $self->{dir} = $args{dir} || "$main::root/mrtg";
32 $self->{html} = $args{html} || "$main::root/html/mrtg";
33 $self->{cfg} = $args{cfg} || "$self->{dir}/mrtg.cfg";
35 my $mc = new IO::File ">$self->{cfg}" or return undef;
38 # print out the header
41 Htmldir: $self->{html}
42 Imagedir: $self->{html}
56 return `mrtg $self->{cfg}`;
61 my ($self, $name, $vali, $valo, $title) = @_;
62 my $uptime = main::uptime();
64 if (my $m = new IO::File ">$self->{dir}/$name" ) {
65 $m->print("$vali\n$valo\n$uptime\n$title\n");
68 dbg("MRTG: cannot open $self->{dir}/$name $!");
74 my ($self, $name, $options, $max, $title, $legend, $iname, $oname) = @_;
75 my $opt = join ', ', @$options, qw(withzeroes growright nopercent integer);
77 $self->{mc}->print(<<"EOF");
83 Target[$name]: `cat /spider/mrtg/$name`
87 YLegend[$name]: $legend
89 ShortLegend[$name]: \
90 Legend1[$name]:Maximum No of $iname
91 Legend2[$name]:Maximum No of $oname
94 PageTop[$name]: <H1>$title</H1>
96 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
97 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
98 <TR><TD>Description:</TD><TD>$title</TD></TR>