#!/usr/bin/perl use strict; use StatGraph; use File::Copy; ## TODO: configure with getopt my $config = "statgraph.conf"; ## Get configuration open CONFIG, $config || die "Cannot open $config: $!"; my @CONFIG = (); close CONFIG; my %CONFIG = confparse(\@CONFIG); my %HOSTS = %{$CONFIG{hosts}}; %CONFIG = %{$CONFIG{config}}; ## Set default configuration options if they've not been specified my $defaultport = $CONFIG{defaultport} || 27001; my $offsets = $CONFIG{offsets} || '10800 86400 604800 2419200 31536000'; my @offsets = split(/\s+/, $offsets); my $rrdlocation = $CONFIG{rrdlocation} || "rrd/"; my $graphlocation = $CONFIG{graphlocation} || "graphs/"; open INDEX, ">$graphlocation/index.html.tmp"; print INDEX htmlheader("StatGraph results"); print INDEX "

StatGraph results

"; print INDEX "

Last updated: " . nice_date; print INDEX "

"; print INDEX htmlfooter; close INDEX; move("$graphlocation/index.html.tmp", "$graphlocation/index.html");