ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/statgrab/statgrab-make-mrtg-index.in
Revision: 1.5
Committed: Fri Jan 16 15:54:56 2004 UTC (20 years, 10 months ago) by tdb
Branch: MAIN
Changes since 1.4: +1 -1 lines
Log Message:
Alter the licensing of libstatgrab. The library part is now under the
LGPL, whilst the tools/examples are under the GPL. Both licenses are
included in the distribution (and are both now in CVS). Also made a
minor alteration to the webpage where it said everything was licensed
under the GPL.

File Contents

# Content
1 #!/usr/bin/perl -w
2 # i-scream central monitoring system
3 # http://www.i-scream.org
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
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
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 use strict;
21 use Getopt::Long;
22
23 my $progname = "statgrab-make-mrtg-config";
24
25 my $package_version = '@PACKAGE_VERSION@';
26 my $package_bugreport = '@PACKAGE_BUGREPORT@';
27 my $help_text = <<EOF;
28 Usage: $progname [OPTION]... [CONFIGFILE]...
29 Generate an XHTML index page on stdout from MRTG config files specified
30 on the command line or read from stdin.
31
32 --title TITLE Use TITLE as the title of the generated page
33 --help Display this help and exit
34
35 Version $package_version - report bugs to $package_bugreport.
36 EOF
37
38 sub main () {
39 my $hostname = `hostname`;
40 chomp $hostname;
41 my $pagetitle = "MRTG: $hostname";
42
43 GetOptions('title=s' => \$pagetitle,
44 'help' => \my $help) or die $help_text;
45 if ($help) {
46 print "$help_text";
47 exit 0;
48 }
49
50 my %pages = ();
51 while (<>) {
52 /^Title\[([^\]]+)\]: (.*)$/ or next;
53 $pages{$2} = $1;
54 }
55 print <<EOF;
56 <?xml version="1.0" encoding="ISO-8859-1"?>
57 <!DOCTYPE html
58 PUBLIC "-//W3C//DTD XHTML 1.1//EN"
59 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
60 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
61 <head>
62 <title>$pagetitle</title>
63 </head>
64 <body>
65 <h1>$pagetitle</h1>
66 EOF
67 foreach my $title (sort keys %pages) {
68 my $page = $pages{$title};
69 print "<h2><a href=\"$page.html\">$title</a></h2>\n";
70 print "<p><img src=\"$page-day.png\" alt=\"$page\" /></p>\n";
71 }
72 print <<EOF;
73 <p>Generated by <a href="http://www.i-scream.org/libstatgrab">
74 libstatgrab</a> version $package_version.</p>
75 </body>
76 </html>
77 EOF
78 }
79
80 main();