|
Packit |
667938 |
#! /usr/bin/perl -w
|
|
Packit |
667938 |
# -*- mode: Perl -*-
|
|
Packit |
667938 |
##################################################################
|
|
Packit |
667938 |
# MRTG 2.17.7 --- Index Generator
|
|
Packit |
667938 |
##################################################################
|
|
Packit |
667938 |
#
|
|
Packit |
667938 |
# This reads a mrtg.cfg file form std input or cmdline argument
|
|
Packit |
667938 |
# and it takes a regexp on the cmdline to specify which
|
|
Packit |
667938 |
# targets to look at.
|
|
Packit |
667938 |
#
|
|
Packit |
667938 |
# from this info it produces a router index on stdout or
|
|
Packit |
667938 |
# on the filename specified by the --output option
|
|
Packit |
667938 |
#
|
|
Packit |
667938 |
##################################################################
|
|
Packit |
667938 |
# Distributed under the GNU General Public License
|
|
Packit |
667938 |
# Copyright 2000 by Tobias Oetiker <tobi@oetiker.ch>
|
|
Packit |
667938 |
##################################################################
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$main::GRAPHFMT="png";
|
|
Packit |
667938 |
|
|
Packit |
667938 |
require 5.005;
|
|
Packit |
667938 |
use strict;
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# DEBUG TARGETS
|
|
Packit |
667938 |
# base - basic program flow
|
|
Packit |
667938 |
#@main::DEBUG=qw(base);
|
|
Packit |
667938 |
|
|
Packit |
667938 |
BEGIN {
|
|
Packit |
667938 |
# Automatic OS detection ... do NOT touch
|
|
Packit |
667938 |
if ( $^O =~ /^(?:(ms)?(dos|win(32|nt)?))/i ) {
|
|
Packit |
667938 |
$main::OS = 'NT';
|
|
Packit |
667938 |
$main::SL = '\\';
|
|
Packit |
667938 |
$main::PS = ';';
|
|
Packit |
667938 |
} elsif ( $^O =~ /^NetWare$/i ) {
|
|
Packit |
667938 |
$main::OS = 'NW';
|
|
Packit |
667938 |
$main::SL = '/';
|
|
Packit |
667938 |
$main::PS = ';';
|
|
Packit |
667938 |
} elsif ( $^O =~ /^VMS$/i ) {
|
|
Packit |
667938 |
$main::OS = 'VMS';
|
|
Packit |
667938 |
$main::SL = '.';
|
|
Packit |
667938 |
$main::PS = ':';
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$main::OS = 'UNIX';
|
|
Packit |
667938 |
$main::SL = '/';
|
|
Packit |
667938 |
$main::PS = ':';
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
use FindBin;
|
|
Packit |
667938 |
use lib "${FindBin::Bin}";
|
|
Packit |
667938 |
use lib "${FindBin::Bin}${main::SL}..${main::SL}lib${main::SL}mrtg2";
|
|
Packit |
667938 |
|
|
Packit |
667938 |
use MRTG_lib "2.100016";
|
|
Packit |
667938 |
use Getopt::Long;
|
|
Packit |
667938 |
use Pod::Usage;
|
|
Packit |
667938 |
|
|
Packit |
667938 |
#----------------------------------------------------------------------
|
|
Packit |
667938 |
sub decimal_sort($$) {
|
|
Packit |
667938 |
my $a = $_[0];
|
|
Packit |
667938 |
my $b = $_[1];
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$a =~ s/([0-9]+)/sprintf("%09u",${1})/ge;
|
|
Packit |
667938 |
$b =~ s/([0-9]+)/sprintf("%09u",${1})/ge;
|
|
Packit |
667938 |
return $a cmp $b;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
#----------------------------------------------------------------------
|
|
Packit |
667938 |
|
|
Packit |
667938 |
my @argv = @ARGV;
|
|
Packit |
667938 |
my $argz = "$0";
|
|
Packit |
667938 |
foreach my $ar (@argv) {
|
|
Packit |
667938 |
if ($ar =~ /[ |()]/ ) {
|
|
Packit |
667938 |
$ar = sprintf qq{"%s"}, $ar;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
$argz .= " $ar";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
main();
|
|
Packit |
667938 |
exit 0;
|
|
Packit |
667938 |
|
|
Packit |
667938 |
sub main {
|
|
Packit |
667938 |
# default options
|
|
Packit |
667938 |
my %opt = (
|
|
Packit |
667938 |
sort => 'original',
|
|
Packit |
667938 |
show => 'day',
|
|
Packit |
667938 |
section => 'h1',
|
|
Packit |
667938 |
columns => 2,
|
|
Packit |
667938 |
addhead => '',
|
|
Packit |
667938 |
bodyopt => 'bgcolor="#ffffff" text="#000000" '.
|
|
Packit |
667938 |
'link="#000000" vlink="#000000" alink="#000000"',
|
|
Packit |
667938 |
title => 'MRTG Index Page',
|
|
Packit |
667938 |
headlevel => 1,
|
|
Packit |
667938 |
pagetopend => '',
|
|
Packit |
667938 |
pagetop => '',
|
|
Packit |
667938 |
pageend => '',
|
|
Packit |
667938 |
prefix => '',
|
|
Packit |
667938 |
rrdviewer => '/cgi-bin/14all.cgi',
|
|
Packit |
667938 |
optlog => 1,
|
|
Packit |
667938 |
bold => 1,
|
|
Packit |
667938 |
boldon => '',
|
|
Packit |
667938 |
boldoff => '',
|
|
Packit |
667938 |
div => 'DIV',
|
|
Packit |
667938 |
imgborder => 1,
|
|
Packit |
667938 |
cellspacing => 10,
|
|
Packit |
667938 |
nolegend => 0,
|
|
Packit |
667938 |
);
|
|
Packit |
667938 |
$opt{headon} = "<H$opt{headlevel}>";
|
|
Packit |
667938 |
$opt{headoff} = "</H$opt{headlevel}>";
|
|
Packit |
667938 |
# load real options
|
|
Packit |
667938 |
options(\%opt);
|
|
Packit |
667938 |
|
|
Packit |
667938 |
#adapt some defaults to the current options
|
|
Packit |
667938 |
die "ERROR: --autoprefix requires --output"
|
|
Packit |
667938 |
if ($opt{autoprefix} and !defined $opt{output});
|
|
Packit |
667938 |
$opt{pageend} = $opt{pagetopend} if (defined $opt{pagetopend} and not $opt{pageend});
|
|
Packit |
667938 |
$opt{pagetop} = $opt{pagetopend} if (defined $opt{pagetopend} and not $opt{pagetop});
|
|
Packit |
667938 |
$opt{boldon} = $opt{boldoff} = "" if (!$opt{bold});
|
|
Packit |
667938 |
$opt{picfirst} = (defined $opt{picfirst}?1:0);
|
|
Packit |
667938 |
if ($opt{compact}) {
|
|
Packit |
667938 |
$opt{imgborder} = 0;
|
|
Packit |
667938 |
$opt{cellspacing} = 0;
|
|
Packit |
667938 |
$opt{headon} = $opt{boldon};
|
|
Packit |
667938 |
$opt{headoff} = $opt{boldoff};
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
if ($opt{sidebyside}) {
|
|
Packit |
667938 |
$opt{div} = 'td';
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# slurp config files
|
|
Packit |
667938 |
my %rcfg;
|
|
Packit |
667938 |
my %cfg;
|
|
Packit |
667938 |
my @target;
|
|
Packit |
667938 |
my @routers;
|
|
Packit |
667938 |
my $cfgfile;
|
|
Packit |
667938 |
my %files;
|
|
Packit |
667938 |
while (@ARGV) {
|
|
Packit |
667938 |
$cfgfile = shift @ARGV;
|
|
Packit |
667938 |
readcfg($cfgfile,\@routers,\%cfg,\%rcfg);
|
|
Packit |
667938 |
if (($opt{sectionhost}) or ($opt{perhost})) {
|
|
Packit |
667938 |
#We need to cache the "hostname" as appeared in cfgfile,
|
|
Packit |
667938 |
#since it does change in cfgcheck (for ex. if multiple
|
|
Packit |
667938 |
#overlapping cfgfiles are specified)
|
|
Packit |
667938 |
for my $targ (@routers) {
|
|
Packit |
667938 |
if ( !defined $rcfg{host}{$targ} and
|
|
Packit |
667938 |
!($rcfg{target}{$targ} =~ m/(?
|
|
Packit |
667938 |
$rcfg{target}{$targ} =~ m/.*[^\\]@([^:]*)/;
|
|
Packit |
667938 |
$rcfg{host}{$targ} = ucfirst $1 if (defined $1);
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
cfgcheck(\@routers, \%cfg, \%rcfg, \@target);
|
|
Packit |
667938 |
for my $targ (@routers) {
|
|
Packit |
667938 |
if (! defined $files{$targ}) {
|
|
Packit |
667938 |
$files{$targ}=substr($cfgfile,rindex($cfgfile,'/')+1);
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
if ($opt{autoprefix}) {
|
|
Packit |
667938 |
$rcfg{prefixes} = {} if (!defined $rcfg{prefixes});
|
|
Packit |
667938 |
my $pref = subpath($cfg{htmldir},$opt{output});
|
|
Packit |
667938 |
for my $targ (@routers) {
|
|
Packit |
667938 |
$rcfg{prefixes}->{$targ} = $pref
|
|
Packit |
667938 |
if (! defined $rcfg{prefixes}->{$targ});
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
# generate index page
|
|
Packit |
667938 |
genindex(\@routers, \%cfg, \%rcfg, \%opt, \%files);
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
sub cleanurl ($) {
|
|
Packit |
667938 |
my $url = shift;
|
|
Packit |
667938 |
$url =~ s|([^/.][^/.]*/)\.\./\1|$1|g;
|
|
Packit |
667938 |
return $url;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
#Take a path the mrtg (usually the mrtg output directory) and the overview
|
|
Packit |
667938 |
#file, find the relative path from the overview to the directory
|
|
Packit |
667938 |
sub subpath ($$) {
|
|
Packit |
667938 |
my $sub = shift;
|
|
Packit |
667938 |
my $out = shift;
|
|
Packit |
667938 |
my @s=split /$main::SL/,$sub;
|
|
Packit |
667938 |
my @o=split /$main::SL/,$out;
|
|
Packit |
667938 |
pop @o; #Last is a filename;
|
|
Packit |
667938 |
for my $i (0..$#s) { #cut common dirs
|
|
Packit |
667938 |
if (defined $s[0] and
|
|
Packit |
667938 |
defined $o[0] and
|
|
Packit |
667938 |
$s[0] eq $o[0] ) {
|
|
Packit |
667938 |
shift @s;
|
|
Packit |
667938 |
shift @o;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
my $ret = join $main::SL,@s;
|
|
Packit |
667938 |
for my $i (0..$#o) {
|
|
Packit |
667938 |
$ret = "..$main::SL$ret"; # ".." == "Directory below this one" for
|
|
Packit |
667938 |
# dos, windows, unix. What about VMS ?
|
|
Packit |
667938 |
# Is this correct ? HEH
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
$ret .= $main::SL; #Possibly this should be "/" in order not
|
|
Packit |
667938 |
#to break on platforms !unix, since it will be
|
|
Packit |
667938 |
#used for generating urls ?
|
|
Packit |
667938 |
#Don't degenerate in "/" when really no prefix is needed.
|
|
Packit |
667938 |
$ret = "" if ($ret eq $main::SL);
|
|
Packit |
667938 |
return $ret;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
sub genindex ($$$$) {
|
|
Packit |
667938 |
my $routers = shift;
|
|
Packit |
667938 |
my $cfg = shift;
|
|
Packit |
667938 |
my $rcfg = shift;
|
|
Packit |
667938 |
my $opt = shift;
|
|
Packit |
667938 |
my $cfgfile = shift;
|
|
Packit |
667938 |
my $index;
|
|
Packit |
667938 |
my $metaCmdLine;
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
# keep only the items our users want (--filter)
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
my @filtered;
|
|
Packit |
667938 |
ITEM: foreach my $item (@{$routers}) {
|
|
Packit |
667938 |
foreach my $filter (@{$$opt{filter}}) {
|
|
Packit |
667938 |
if ($filter =~ /(.+)([=!]~)(.+)/) {
|
|
Packit |
667938 |
my ($area,$comp,$regex) = ($1,$2,$3);
|
|
Packit |
667938 |
my $value;
|
|
Packit |
667938 |
for ($area) {
|
|
Packit |
667938 |
/^title|pagetop$/ &&
|
|
Packit |
667938 |
do { $value = $$rcfg{$area}{$item}; last };
|
|
Packit |
667938 |
|
|
Packit |
667938 |
/^name$/ &&
|
|
Packit |
667938 |
do { $value = $item; last };
|
|
Packit |
667938 |
|
|
Packit |
667938 |
die "ERROR: unknown filter area $_\n";
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
for ($comp) {
|
|
Packit |
667938 |
/^=~$/ &&
|
|
Packit |
667938 |
do { next ITEM unless $value =~ /$regex/; last };
|
|
Packit |
667938 |
/^!~$/ &&
|
|
Packit |
667938 |
do { next ITEM unless $value !~ /$regex/; last };
|
|
Packit |
667938 |
die "ERROR: unknown comparison operator $_\n";
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
die "ERROR: invalid filter expression $filter\n";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
push @filtered, $item;
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
# get items into proper order (--sort)
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
my @order;
|
|
Packit |
667938 |
for ($$opt{sort}) {
|
|
Packit |
667938 |
/^original$/ && do {@order = @filtered; last};
|
|
Packit |
667938 |
/^name$/ && do { @order = sort { decimal_sort($a,$b); } @filtered; last};
|
|
Packit |
667938 |
/^title$/ && do { @order =
|
|
Packit |
667938 |
sort { decimal_sort($$rcfg{title}{$a}, $$rcfg{title}{$b}) || $a cmp $b }
|
|
Packit |
667938 |
@filtered;
|
|
Packit |
667938 |
last;
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
/^descr(iption)?$/ &&
|
|
Packit |
667938 |
do {
|
|
Packit |
667938 |
@order =
|
|
Packit |
667938 |
sort {
|
|
Packit |
667938 |
$$rcfg{pagetop}{$a} =~
|
|
Packit |
667938 |
m[Description:\s*(?:\S+\s+)?(.+?)]i;
|
|
Packit |
667938 |
my $aval = lc $1;
|
|
Packit |
667938 |
$$rcfg{pagetop}{$b} =~
|
|
Packit |
667938 |
m[Description:\s*(?:\S+\s+)?(.+?)]i;
|
|
Packit |
667938 |
my $bval = lc $1;
|
|
Packit |
667938 |
$aval cmp $bval;
|
|
Packit |
667938 |
} @filtered;
|
|
Packit |
667938 |
last;
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
die "ERROR: unknown sort order '$$opt{sort}'\n";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
die "ERROR: did not find any matching data in cfg file\n" unless @order;
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
# issue page top
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
my $interval =$$cfg{'interval'} ? $$cfg{'interval'} : 5;
|
|
Packit |
667938 |
my $expiration = &expistr($interval);
|
|
Packit |
667938 |
my $refresh = $$cfg{'refresh'} ? $$cfg{'refresh'} : 300;
|
|
Packit |
667938 |
for ($$opt{show}) {
|
|
Packit |
667938 |
$refresh = /^week$/ && 1800
|
|
Packit |
667938 |
|| /^month$/ && 7200
|
|
Packit |
667938 |
|| /^year$/ && 86400
|
|
Packit |
667938 |
|| $refresh ;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
my $gifPath = '';
|
|
Packit |
667938 |
|
|
Packit |
667938 |
if ($$cfg{icondir} || $$opt{icondir}) {
|
|
Packit |
667938 |
$gifPath = $$opt{icondir} || $$cfg{icondir};
|
|
Packit |
667938 |
#lets make sure there is a trailing path separator
|
|
Packit |
667938 |
$gifPath =~ s|/*$|/|;
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$gifPath = "$$cfg{imagehtml}";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
if ($$opt{optlog}) {
|
|
Packit |
667938 |
$metaCmdLine = $argz;
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$metaCmdLine = "<suppressed>";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$metaCmdLine =~ s/&/&/g; # Must be first, otherwise it will affect the following changes
|
|
Packit |
667938 |
$metaCmdLine =~ s/"/"/g;
|
|
Packit |
667938 |
$metaCmdLine =~ s/</</g;
|
|
Packit |
667938 |
$metaCmdLine =~ s/>/>/g;
|
|
Packit |
667938 |
my $headeradd = $$opt{headeradd} || "";
|
|
Packit |
667938 |
$index = <
|
|
Packit |
667938 |
|
|
Packit |
667938 |
<HTML>
|
|
Packit |
667938 |
<HEAD>
|
|
Packit |
667938 |
<TITLE>$$opt{title}</TITLE>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
<meta http-equiv="content-type" content="text/html; charset=iso-8859-15" >
|
|
Packit |
667938 |
<META NAME="Command-Line" CONTENT="$metaCmdLine" >
|
|
Packit |
667938 |
<META HTTP-EQUIV="Refresh" CONTENT="$refresh" >
|
|
Packit |
667938 |
<META HTTP-EQUIV="Cache-Control" content="no-cache" >
|
|
Packit |
667938 |
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" >
|
|
Packit |
667938 |
<META HTTP-EQUIV="Expires" CONTENT="$expiration" >
|
|
Packit |
667938 |
<LINK HREF="${gifPath}favicon.ico" rel="shortcut icon" >
|
|
Packit |
667938 |
$headeradd
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
<style type="text/css">
|
|
Packit |
667938 |
/* commandline was: $argz */
|
|
Packit |
667938 |
/* sorry, no style, just abusing this to place the commandline and pass validation */
|
|
Packit |
667938 |
</style>
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
$$opt{addhead}
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
</HEAD>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
<BODY $$opt{bodyopt}>
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$$opt{pagetop}
|
|
Packit |
667938 |
$$opt{headon}$$opt{title}$$opt{headoff}
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
$$opt{subtitle}
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
# print the graph items
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
my $itemnr = 0;
|
|
Packit |
667938 |
my $first = $order[0];
|
|
Packit |
667938 |
my $host = $$rcfg{host}{$first};
|
|
Packit |
667938 |
if ($host){
|
|
Packit |
667938 |
$index .= "$$opt{headon}Interfaces of $host $$opt{headoff}" if $$opt{perhost};
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$index .= "$$opt{headon}Special Items$$opt{headoff}" if $$opt{perhost};
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
foreach my $item (@order) {
|
|
Packit |
667938 |
|
|
Packit |
667938 |
if ($$opt{perhost}) {
|
|
Packit |
667938 |
my $newhost = $$rcfg{host}{$item} || 'unspecified host';
|
|
Packit |
667938 |
if (!($host eq $newhost)) {
|
|
Packit |
667938 |
$host = $newhost;
|
|
Packit |
667938 |
if ($host){
|
|
Packit |
667938 |
$index .= "$$opt{headon}Interfaces of $host $$opt{headoff}\n";
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$index .= "$$opt{headon}Special Items$$opt{headoff}\n";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
$index .= "\n";
|
|
Packit |
667938 |
$itemnr=0;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
$$opt{prefix} = $$rcfg{prefixes}->{$item} if ($$opt{autoprefix});
|
|
Packit |
667938 |
$itemnr++;
|
|
Packit |
667938 |
$index .= "";
|
|
Packit |
667938 |
my $dirrel = "../" x ($$rcfg{'directory_web'}{$item} =~ tr|/|/|);
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# --- produce graph section title ---
|
|
Packit |
667938 |
my $section;
|
|
Packit |
667938 |
for ($$opt{section}) {
|
|
Packit |
667938 |
/^h1$/ &&
|
|
Packit |
667938 |
do{
|
|
Packit |
667938 |
if ($$rcfg{pagetop}{$item} =~ m[<h1[^>+]*>(.+?)
|
|
Packit |
667938 |
$section = $1;
|
|
Packit |
667938 |
last;
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
die "ERROR: no H1 line pagetop property in $item section\n";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
/^title$/ &&
|
|
Packit |
667938 |
do{
|
|
Packit |
667938 |
$section = $$rcfg{title}{$item}; last
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
/^name$/ &&
|
|
Packit |
667938 |
do{
|
|
Packit |
667938 |
$section = $item; last
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
/^descr(iption)?$/ &&
|
|
Packit |
667938 |
do{
|
|
Packit |
667938 |
$section = "No Description for $item";
|
|
Packit |
667938 |
$$rcfg{setenv}{$item} =~ /MRTG_INT_DESCR="(.+?)"/ #"
|
|
Packit |
667938 |
and $section = $1;
|
|
Packit |
667938 |
$$rcfg{pagetop}{$item} =~
|
|
Packit |
667938 |
m,Description:\s*\Q$section\E\s*([^< ][^<]+?),i
|
|
Packit |
667938 |
and $section = $1;
|
|
Packit |
667938 |
last;
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
/^portname$/ &&
|
|
Packit |
667938 |
do{
|
|
Packit |
667938 |
$section = "No Portname for $item";
|
|
Packit |
667938 |
$$rcfg{pagetop}{$item} =~ m,Port Name:\s*(.*?),i
|
|
Packit |
667938 |
and $section = $1;
|
|
Packit |
667938 |
last;
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
/^ifname$/ &&
|
|
Packit |
667938 |
do{
|
|
Packit |
667938 |
$section = "No Portname for $item";
|
|
Packit |
667938 |
$$rcfg{pagetop}{$item} =~ m,ifname:\s*(.*?),i
|
|
Packit |
667938 |
and $section = $1;
|
|
Packit |
667938 |
last;
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
die "ERROR: unknown sectioning type $_\n";
|
|
Packit |
667938 |
};
|
|
Packit |
667938 |
if (defined $$rcfg{host}{$item} and
|
|
Packit |
667938 |
!($section =~ m/\b\Q$$rcfg{host}{$item}\E\b/i)) {
|
|
Packit |
667938 |
$section = ucfirst $$rcfg{host}{$item} . ": $section";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# --- write the actual graph ----
|
|
Packit |
667938 |
die "ERROR: Unknown show type $$opt{show}\n"
|
|
Packit |
667938 |
unless $$opt{show} =~ /^day|week|month|year|none$/;
|
|
Packit |
667938 |
|
|
Packit |
667938 |
my $image = "$item-$$opt{show}.${main::GRAPHFMT}"
|
|
Packit |
667938 |
if $$opt{show} ne 'none';
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= "<$$opt{div}>" if (!$$opt{sidebyside});
|
|
Packit |
667938 |
|
|
Packit |
667938 |
if (not $image) {
|
|
Packit |
667938 |
if ($$cfg{logformat} eq 'rrdtool') {
|
|
Packit |
667938 |
my $sep = $$opt{rrdviewer} =~ /\?/ ? '&' : '?';
|
|
Packit |
667938 |
$index .=
|
|
Packit |
667938 |
"".
|
|
Packit |
667938 |
"$$opt{boldon}".
|
|
Packit |
667938 |
"$section$$opt{boldoff}";
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$index .= "$$opt{boldon}".
|
|
Packit |
667938 |
"
|
|
Packit |
667938 |
$$rcfg{directory_web}{$item}).$item.
|
|
Packit |
667938 |
".$$rcfg{extension}{$item}\">".
|
|
Packit |
667938 |
"$section$$opt{boldoff}</$$opt{div}>\n<$$opt{div}>";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
#loop used for reversing (text,images) to (images,text) if req.
|
|
Packit |
667938 |
for my $picfirstloop (1,0) {
|
|
Packit |
667938 |
if ( $picfirstloop^$$opt{picfirst} ) {
|
|
Packit |
667938 |
$index .= "$$opt{boldon}$itemnr. $$opt{boldoff}"
|
|
Packit |
667938 |
if $$opt{enumerate};
|
|
Packit |
667938 |
if ($$opt{clicktext}) {
|
|
Packit |
667938 |
$index .= "$$opt{boldon}
|
|
Packit |
667938 |
$$rcfg{directory_web}{$item}).$item.
|
|
Packit |
667938 |
".$$rcfg{extension}{$item}\">";
|
|
Packit |
667938 |
$index .= $section;
|
|
Packit |
667938 |
$index .= "$$opt{boldoff}";
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$index .= "$$opt{boldon}$section$$opt{boldoff}";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
$index .= "</$$opt{div}>\n<$$opt{div}>" if $picfirstloop;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
if ( !($picfirstloop^$$opt{picfirst}) ) {
|
|
Packit |
667938 |
# figure show name for rrd viewer
|
|
Packit |
667938 |
if ($$cfg{logformat} eq 'rrdtool') {
|
|
Packit |
667938 |
my $sep = $$opt{rrdviewer} =~ /\?/ ? '&' : '?';
|
|
Packit |
667938 |
$index .= "".
|
|
Packit |
667938 |
"
|
|
Packit |
667938 |
"SRC=\"$$opt{rrdviewer}".$sep."log=$item&cfg=$$cfgfile{$item}&png=$$opt{show}.".
|
|
Packit |
667938 |
"s&small=1\">"
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
$index .= "
|
|
Packit |
667938 |
$$rcfg{directory_web}{$item}).$item.
|
|
Packit |
667938 |
".$$rcfg{extension}{$item}\">";
|
|
Packit |
667938 |
$index .= "
|
|
Packit |
667938 |
"SRC=\"".cleanurl($$opt{prefix}.
|
|
Packit |
667938 |
$$rcfg{directory_web}{$item}.$dirrel.
|
|
Packit |
667938 |
$$cfg{imagehtml}.$$rcfg{directory_web}{$item}).
|
|
Packit |
667938 |
"$image\"";
|
|
Packit |
667938 |
$index .= ' WIDTH="'.$$opt{width}.'"'
|
|
Packit |
667938 |
if defined $$opt{width};
|
|
Packit |
667938 |
$index .= ' HEIGHT="'.$$opt{height}.'"'
|
|
Packit |
667938 |
if defined $$opt{height};
|
|
Packit |
667938 |
$index .= ">";
|
|
Packit |
667938 |
$index .= " "
|
|
Packit |
667938 |
if ( ! defined $$opt{compact} );
|
|
Packit |
667938 |
$index .= "\n<SMALL>
|
|
Packit |
667938 |
cleanurl($$opt{prefix}.$$rcfg{directory_web}{$item}).$item.
|
|
Packit |
667938 |
".$$rcfg{extension}{$item}\" --></SMALL>";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
$index .= "</$$opt{div}>\n<$$opt{div}>" if $picfirstloop;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= "</$$opt{div}>" if (!$$opt{sidebyside});
|
|
Packit |
667938 |
$index .= "\n";
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# --- new table column if necessary ----
|
|
Packit |
667938 |
if (($itemnr) % $$opt{columns} == 0) {
|
|
Packit |
667938 |
$index .= "\n\n";
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
# print page end
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
my $VERSION = "2.17.7";
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
$$opt{pageend}
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
HREF="http://oss.oetiker.ch/mrtg/">
|
|
Packit |
667938 |
BORDER=0 SRC="${gifPath}mrtg-l.${main::GRAPHFMT}" WIDTH=63 HEIGHT=25 ALT="MRTG">
|
|
Packit |
667938 |
|
|
Packit |
667938 |
HREF="http://oss.oetiker.ch/mrtg/">
|
|
Packit |
667938 |
BORDER=0 SRC="${gifPath}mrtg-m.${main::GRAPHFMT}" WIDTH=25 HEIGHT=25 ALT="">
|
|
Packit |
667938 |
|
|
Packit |
667938 |
HREF="http://oss.oetiker.ch/mrtg/">
|
|
Packit |
667938 |
BORDER=0 SRC="${gifPath}mrtg-r.${main::GRAPHFMT}" WIDTH=388 HEIGHT=25
|
|
Packit |
667938 |
ALT="Multi Router Traffic Grapher">
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
<FONT FACE="Arial,Helvetica" SIZE=2>
|
|
Packit |
667938 |
version $VERSION</FONT>
|
|
Packit |
667938 |
<FONT FACE="Arial,Helvetica" SIZE=2>
|
|
Packit |
667938 |
Tobias Oetiker
|
|
Packit |
667938 |
<tobi\@oetiker.ch>
|
|
Packit |
667938 |
and Dave Rand <dlr\@bungi.com></FONT>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
$index .= <
|
|
Packit |
667938 |
</BODY>
|
|
Packit |
667938 |
</HTML>
|
|
Packit |
667938 |
ECHO
|
|
Packit |
667938 |
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
# write out the index page
|
|
Packit |
667938 |
# -----------------------------------------------------------
|
|
Packit |
667938 |
if ($$opt{output}) {
|
|
Packit |
667938 |
debug ('base', "Writing $$opt{output}");
|
|
Packit |
667938 |
open X, ">$$opt{output}" or die "ERROR: creating $$opt{output}: $!\n";
|
|
Packit |
667938 |
print X $index;
|
|
Packit |
667938 |
close X;
|
|
Packit |
667938 |
} else {
|
|
Packit |
667938 |
print $index;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
sub options ($) {
|
|
Packit |
667938 |
my $opt = shift;
|
|
Packit |
667938 |
my @options = (
|
|
Packit |
667938 |
'help|?',
|
|
Packit |
667938 |
'man',
|
|
Packit |
667938 |
'output=s',
|
|
Packit |
667938 |
'filter=s@',
|
|
Packit |
667938 |
'addhead=s',
|
|
Packit |
667938 |
'title=s',
|
|
Packit |
667938 |
'subtitle=s',
|
|
Packit |
667938 |
'bodyopt=s',
|
|
Packit |
667938 |
'pagetopend=s',
|
|
Packit |
667938 |
'pagetop=s',
|
|
Packit |
667938 |
'pageend=s',
|
|
Packit |
667938 |
'columns=i',
|
|
Packit |
667938 |
'perhost!',
|
|
Packit |
667938 |
'sort=s',
|
|
Packit |
667938 |
'enumerate',
|
|
Packit |
667938 |
'width=i',
|
|
Packit |
667938 |
'height=i',
|
|
Packit |
667938 |
'show=s',
|
|
Packit |
667938 |
'section=s',
|
|
Packit |
667938 |
'version',
|
|
Packit |
667938 |
'prefix=s',
|
|
Packit |
667938 |
'headeradd=s',
|
|
Packit |
667938 |
'clicktext!',
|
|
Packit |
667938 |
'optlog!',
|
|
Packit |
667938 |
'compact!',
|
|
Packit |
667938 |
'headlevel=i',
|
|
Packit |
667938 |
'bold!',
|
|
Packit |
667938 |
'picfirst!',
|
|
Packit |
667938 |
'sidebyside!',
|
|
Packit |
667938 |
'nolegend',
|
|
Packit |
667938 |
'autoprefix!',
|
|
Packit |
667938 |
'sectionhost!',
|
|
Packit |
667938 |
'icondir=s',
|
|
Packit |
667938 |
'rrdviewer=s');
|
|
Packit |
667938 |
|
|
Packit |
667938 |
#generate --option-file from --option
|
|
Packit |
667938 |
for ( grep /=s$/,@options ) {
|
|
Packit |
667938 |
my $fileopt = $_;
|
|
Packit |
667938 |
$fileopt =~ s/=s$/-file=s/;
|
|
Packit |
667938 |
push @options, $fileopt;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
GetOptions( $opt, @options ) or pod2usage(-verbose => 1);
|
|
Packit |
667938 |
|
|
Packit |
667938 |
if ($$opt{prefix}){
|
|
Packit |
667938 |
$$opt{prefix} .= '/';
|
|
Packit |
667938 |
$$opt{prefix} =~ s|/+$|/|;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
die ("Indexmaker for mrtg-2.17.7\n") if $$opt{version};
|
|
Packit |
667938 |
pod2usage(-exitval => 1, -verbose => 2) if $$opt{man};
|
|
Packit |
667938 |
pod2usage(-verbose => 1) if not @ARGV;
|
|
Packit |
667938 |
|
|
Packit |
667938 |
#take care of --fileoption --> --option
|
|
Packit |
667938 |
for my $fileopt ( grep /-file$/, keys %{$opt} ) {
|
|
Packit |
667938 |
my $orgopt = $fileopt;
|
|
Packit |
667938 |
$orgopt =~ s/-file$//;
|
|
Packit |
667938 |
$$opt{$orgopt} = &readfile($$opt{$fileopt});
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
#return the contents of a file
|
|
Packit |
667938 |
sub readfile($) {
|
|
Packit |
667938 |
my $file = shift;
|
|
Packit |
667938 |
open F,"<$file" or die "ERROR: can\'t open $file for read, $!";
|
|
Packit |
667938 |
my $sl = $/;
|
|
Packit |
667938 |
$/ = undef;
|
|
Packit |
667938 |
my $string = <F>;
|
|
Packit |
667938 |
$/ = $sl;
|
|
Packit |
667938 |
close F;
|
|
Packit |
667938 |
return $string;
|
|
Packit |
667938 |
}
|
|
Packit |
667938 |
|
|
Packit |
667938 |
__END__
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=pod
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 NAME
|
|
Packit |
667938 |
|
|
Packit |
667938 |
indexmaker - Creates index files for mrtg web sites (mrtg-2.17.7)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 SYNOPSIS
|
|
Packit |
667938 |
|
|
Packit |
667938 |
indexmaker [options] mrtg.cfg [other.cfg ...]
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 OPTIONS
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--output=filename set output filename (default: stdout)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--filter title=~regexp select targets by matching regexp against titles
|
|
Packit |
667938 |
--filter pagetop=~regexp select targets by matching regexp against pagetop
|
|
Packit |
667938 |
--filter name=~regexp select targets by matchin regexp against name
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--addhead=text insert this text between </TITLE> and </HEAD>
|
|
Packit |
667938 |
--title=text set title of generated index file
|
|
Packit |
667938 |
--subtitle=text add a subtitle to the generated index file
|
|
Packit |
667938 |
--bodyopt=text set body tag options
|
|
Packit |
667938 |
--headlevel=number use <Hnumber> at top of page (default: 1)
|
|
Packit |
667938 |
--pagetop=text insert this text between <BODY> and ...
|
|
Packit |
667938 |
--pageend=text insert this text after the main body
|
|
Packit |
667938 |
--pagetopend=text use this text for pagetop or pageend if undefined
|
|
Packit |
667938 |
--nolegend do not add the Mrtg legend at the end of the page
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--columns=number show graphs in a table with x columns (default: 2)
|
|
Packit |
667938 |
--perhost show graphs of the same host on a row
|
|
Packit |
667938 |
--compact try to make a vertically more compact page
|
|
Packit |
667938 |
--optlog log the used command line in the page (default: log)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--sort=title sort graphs by title
|
|
Packit |
667938 |
--sort=name sort graphs by their name
|
|
Packit |
667938 |
--sort=descr sort graphs by their description
|
|
Packit |
667938 |
--sort=original leave as is (default)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--enumerate add a sequence number to the title of each graph
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--picfirst place pictures before text (default: text first)
|
|
Packit |
667938 |
--width=number set width of graphs (default: not set)
|
|
Packit |
667938 |
--height=number
|
|
Packit |
667938 |
--sidebyside place text / pictures side by side (default: above/below)
|
|
Packit |
667938 |
--bold use bold text (default: bold)
|
|
Packit |
667938 |
--clicktext make the text link to the inner page (like the image)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--show=day pick which graph to show in the index (default)
|
|
Packit |
667938 |
--show=week
|
|
Packit |
667938 |
--show=month
|
|
Packit |
667938 |
--show=year
|
|
Packit |
667938 |
--show=none
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--section=h1 h1 tag from pagetop as section heading (default)
|
|
Packit |
667938 |
--section=title title as section headings for graphs
|
|
Packit |
667938 |
--section=name graph name as section heading
|
|
Packit |
667938 |
--section=descr graph description as section heading
|
|
Packit |
667938 |
--section=ifname interface name (ifName) as section heading
|
|
Packit |
667938 |
--section=portname port name entry in pagetop as section heading
|
|
Packit |
667938 |
--sectionhost Try to prepend the host to the section heading if missing
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--rrdviewer=path path to rrdviewer (default: /cgi-bin/14all.cgi)
|
|
Packit |
667938 |
--icondir=path path to icondir
|
|
Packit |
667938 |
--prefix=path path from the location of the index.html to the graphs
|
|
Packit |
667938 |
--headeradd=string add string to the html page header
|
|
Packit |
667938 |
--autoprefix try to set prefix automatically
|
|
Packit |
667938 |
|
|
Packit |
667938 |
--<opt>-file=file read string argument for option <opt> from file
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 DESCRIPTION
|
|
Packit |
667938 |
|
|
Packit |
667938 |
B<Indexmaker> can create web pages which display the status of an
|
|
Packit |
667938 |
array of mrtg interface status pages.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=over
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--output> I<filename>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
set output filename (default: stdout)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--filter> (B<title>|B<pagetop>|B<name>)(B<=~>|B)I<regexp>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Several filters may get set. Each filter can match agains the contents
|
|
Packit |
667938 |
of a specific section of the mrtg config file. B<Name> refers to the
|
|
Packit |
667938 |
bit in square brackets (option[name]: bla).
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Depending on the match operator chosen (B<=~> or B) the match will be
|
|
Packit |
667938 |
positive or negative.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Note that some shells consider B a special character. It may be
|
|
Packit |
667938 |
necessary to type B<\!~> instead.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--title> I<text>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Set title of generated index file (default: regexp)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--bodyopt> I<text>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
The value of this argument gets appended to
|
|
Packit |
667938 |
the E<lt>BODYE<gt> tag. This allows you to set document colors.
|
|
Packit |
667938 |
By default this option is set to
|
|
Packit |
667938 |
|
|
Packit |
667938 |
bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000"
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--columns> I<number>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Display graphs in a table with I<number> columns (default: 2)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--sort> B<title>|B<name>|B<descr>|B<original>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Sort the graphs in the page either by B<title>, by B<name>, by interface
|
|
Packit |
667938 |
B<descr>iption, or leave them as is.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--enumerate>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Add a sequence number to the title of each graph
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--width> I<number>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Set width of graphs
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--height> I<number>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Set the height of the graphs
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--show> B<day>|B<week>|B<month>|B<year>|B<none>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Select which graph to show in the index page. You can supress images
|
|
Packit |
667938 |
completely with B<--show=none>.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--section> B|B<title>|B<name>|B<description>|B<portname>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Select what to use as the title for each graph in the page. B is
|
|
Packit |
667938 |
the H1 section from pagetop, B<title> is the graph title, B<name> is
|
|
Packit |
667938 |
the bit in square brackets (option[name]: bla), and B<descr> or
|
|
Packit |
667938 |
B<description> is the text from the Description field of the PageTop
|
|
Packit |
667938 |
(the Cisco description text if it's available, otherwise just the
|
|
Packit |
667938 |
interface description). B<portname> is the C<Port Name:> from pagetop.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--sectionhost>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Extract the hostname from the target line (this does not work if the
|
|
Packit |
667938 |
target is a mathematial expression). Prepend the hostname (and a colon)
|
|
Packit |
667938 |
to the section if not already present.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--rrdviewer> I<path>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
If you have set the B<LogFormat: rrdtool> property in the mrtg.cfg
|
|
Packit |
667938 |
file, the index will take this into account. The only thing you must
|
|
Packit |
667938 |
tell it is the path to your grapher cgi. (default: /cgi-bin/14all.cgi)
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--prefix> I<path>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
By default we assume that the file generated by indexmaker is stored in
|
|
Packit |
667938 |
I<WorkDir>. If you want to store it somewhere else, specify how to reach
|
|
Packit |
667938 |
I<WorkDir> from the place where the Index is stored. Note that you have to
|
|
Packit |
667938 |
use '/' as path separator as this will be used in urls. Speaking of which,
|
|
Packit |
667938 |
you can even enter a whole url.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--autoprefix> I<path>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Requires --output.
|
|
Packit |
667938 |
Try to generate the prefix automatically by comparision of the path to the
|
|
Packit |
667938 |
output file set with --output and the Htmldir set in the configuration files.
|
|
Packit |
667938 |
Particulary useful when multiple configuration files are specified, with
|
|
Packit |
667938 |
different Htmldir settings.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--optlog>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Default is logging in the generated page the command line, suppress with
|
|
Packit |
667938 |
--nooptlog . Useful if the commandline contains a complex --pagetop=string
|
|
Packit |
667938 |
which could confuse simple browsers.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=item B<--someoption-file> I<filename>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
For any someoption which takes a I<string> as parameter you can read the
|
|
Packit |
667938 |
string from a file by adding <-file> to the option keyword. The whole
|
|
Packit |
667938 |
content of the file will be read and used as the I<string>. The file must
|
|
Packit |
667938 |
exist.
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=back
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 AUTHOR
|
|
Packit |
667938 |
|
|
Packit |
667938 |
Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 LICENSE
|
|
Packit |
667938 |
|
|
Packit |
667938 |
GNU General Public License
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=head1 COPYRIGHT
|
|
Packit |
667938 |
|
|
Packit |
667938 |
2000-2001 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
|
|
Packit |
667938 |
|
|
Packit |
667938 |
=cut
|