--- projects/libstatgrab/src/statgrab/statgrab-make-mrtg-index.in 2003/08/28 11:26:42 1.1 +++ projects/libstatgrab/src/statgrab/statgrab-make-mrtg-index.in 2004/01/19 16:49:23 1.6 @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # i-scream central monitoring system # http://www.i-scream.org -# Copyright (C) 2000-2003 i-scream +# Copyright (C) 2000-2004 i-scream # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# $Id: statgrab-make-mrtg-index.in,v 1.6 2004/01/19 16:49:23 tdb Exp $ use strict; use Getopt::Long; @@ -29,13 +31,19 @@ Usage: $progname [OPTION]... [CONFIGFILE]... Generate an XHTML index page on stdout from MRTG config files specified on the command line or read from stdin. +--title TITLE Use TITLE as the title of the generated page --help Display this help and exit Version $package_version - report bugs to $package_bugreport. EOF sub main () { - GetOptions('help' => \my $help) or die $help_text; + my $hostname = `hostname`; + chomp $hostname; + my $pagetitle = "MRTG: $hostname"; + + GetOptions('title=s' => \$pagetitle, + 'help' => \my $help) or die $help_text; if ($help) { print "$help_text"; exit 0; @@ -53,17 +61,19 @@ sub main () { "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> - MRTG + $pagetitle -

MRTG

+

$pagetitle

EOF foreach my $title (sort keys %pages) { my $page = $pages{$title}; print "

$title

\n"; - print "\n"; + print "

\"$page\"

\n"; } print <Generated by +libstatgrab version $package_version.

EOF