#!/usr/bin/perl -w #============================================================================= # # this is a crappy script to generate a staticish web page to link # into 14all to show the graphs for that target # # Copyright 2006 The University of Wisconsin Board of Regents # Licensed and distributed under the terms of the Perl Artistic # License, see http://net.doit.wisc.edu/~dwcarder/scripts/ for # details. # # Written by: Dale W. Carder, dwcarder@doit.wisc.edu # Network Services Group # Division of Information Technology # University of Wisconsin at Madison # # For more about this and other tools, see # http://net.doit.wisc.edu/~dwcarder/scripts/ # #============================================================================= my $mrtg_cfg='/var/local/mrtg/6500/targets.cfg'; my $cgi='https://stats.net.wisc.edu/cgi-bin/14all_search6500.cgi'; sub printtarget($); my $html=< EOM print $html; # slurp in mrtg targets file line by line open(MRTG, "< $mrtg_cfg") or die ("AHHH!!!! $!\n"); while () { my $line = $_; my $target; if ($line =~ m/Target\[(.+)\]/) { $target = $1; } else { next; } printtarget($target); } $html=< EOM print $html; exit(0); sub printtarget($) { my $item = shift; my $url = $cgi . '?log=' . $item . '&dsType='; $url = lc($url); if ($item =~ m/bytes/) { $url = $url . 'bytes'; } print "$item
\n"; }