| 1 |
|
#!/usr/bin/perl -w |
| 2 |
|
# i-scream central monitoring system |
| 3 |
|
# http://www.i-scream.org |
| 4 |
< |
# Copyright (C) 2000-2003 i-scream |
| 4 |
> |
# Copyright (C) 2000-2004 i-scream |
| 5 |
|
# |
| 6 |
|
# This program is free software; you can redistribute it and/or |
| 7 |
|
# modify it under the terms of the GNU General Public License |
| 16 |
|
# You should have received a copy of the GNU General Public License |
| 17 |
|
# along with this program; if not, write to the Free Software |
| 18 |
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
+ |
# |
| 20 |
+ |
# $Id$ |
| 21 |
|
|
| 22 |
|
use strict; |
| 23 |
|
use Getopt::Long; |
| 31 |
|
Generate an XHTML index page on stdout from MRTG config files specified |
| 32 |
|
on the command line or read from stdin. |
| 33 |
|
|
| 34 |
+ |
--title TITLE Use TITLE as the title of the generated page |
| 35 |
|
--help Display this help and exit |
| 36 |
|
|
| 37 |
|
Version $package_version - report bugs to $package_bugreport. |
| 38 |
|
EOF |
| 39 |
|
|
| 40 |
|
sub main () { |
| 41 |
< |
GetOptions('help' => \my $help) or die $help_text; |
| 41 |
> |
my $hostname = `hostname`; |
| 42 |
> |
chomp $hostname; |
| 43 |
> |
my $pagetitle = "MRTG: $hostname"; |
| 44 |
> |
|
| 45 |
> |
GetOptions('title=s' => \$pagetitle, |
| 46 |
> |
'help' => \my $help) or die $help_text; |
| 47 |
|
if ($help) { |
| 48 |
|
print "$help_text"; |
| 49 |
|
exit 0; |
| 61 |
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 62 |
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 63 |
|
<head> |
| 64 |
< |
<title>MRTG</title> |
| 64 |
> |
<title>$pagetitle</title> |
| 65 |
|
</head> |
| 66 |
|
<body> |
| 67 |
< |
<h1>MRTG</h1> |
| 67 |
> |
<h1>$pagetitle</h1> |
| 68 |
|
EOF |
| 69 |
|
foreach my $title (sort keys %pages) { |
| 70 |
|
my $page = $pages{$title}; |
| 71 |
|
print "<h2><a href=\"$page.html\">$title</a></h2>\n"; |
| 72 |
< |
print "<img src=\"$page-day.png\" />\n"; |
| 72 |
> |
print "<p><img src=\"$page-day.png\" alt=\"$page\" /></p>\n"; |
| 73 |
|
} |
| 74 |
|
print <<EOF; |
| 75 |
+ |
<p>Generated by <a href="http://www.i-scream.org/libstatgrab"> |
| 76 |
+ |
libstatgrab</a> version $package_version.</p> |
| 77 |
|
</body> |
| 78 |
|
</html> |
| 79 |
|
EOF |