Server Usage Tracker

The daily usage graph within these pages is generated by a combination of unix and perl hackery. For the curious I am presenting the programs here without explaination, or warranty of their fitness for any purpose, and do not plan to update or support this program beyond creating this page. The main work is done by a set of cron tasks installed by the following cronfile:
0 9 * * 1-6 echo "<FONT COLOR=red>" >>public_html/usage0.html
0 18 * * 1-6 echo "</FONT>" >>public_html/usage0.html
10 * * * * /usr/local/bin/perl -e 'print +((localtime(time))[2]).": ".("*" x split(/\n/,`who`))."<BR>\n";' >>public_html/usage0.html
05 0 * * * progs/newupdate.pl
06 0 * * * progs/usage3D.pl
The first two lines add colour to the graph to highlight HK Supernet's peak billing period, the third line actually draws the lines of the graph, while the fourth runs the program below, which creates the files and inserts the header and footer of the page where appropriate. The last line calls a program to generate a 3D graph of the results.
#!/usr/local/bin/perl
#Yet another cheap hack by John, 11 Jun 95, 9 Mar 96
    ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
    ($mname) = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")[$mon];
    ($dname) = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")[$wday];
    $/ = "&^&";
	open(OLD, "public_html/usage0.html");
	$temp = <OLD>;
	close(OLD);
	$/ = "\n";
	open(OUT, ">public_html/is1usage.html");
	print OUT $temp;
	print OUT <<"EOM";
<HR>
<IMG SRC="icons/greendot.gif"> <A HREF="home.html">John's Home Page</A>
</BODY>
</HTML>
EOM
	open(NEW, ">public_html/usage0.html");
	print NEW <<"EOM";
<HTML>
<HEAD>
<TITLE>Supernet Usage Tracker for $dname, $mday $mname 19$year</TITLE>
</HEAD>
<BODY>
<H1 ALIGN=CENTER>Supernet Usage Tracker</H1>
This is a very imprecise usage tracker for <A HREF="/">hk.super.net</A>.
Every hour it prints the number of sessions on is1, as given by
the 'who' command. This means it ignores all other servers, UUCP,
SLIP and PPP connections.
<P>
Despite these limitations it does give some indication of when
Supernet's servers are quietest and busiest, which you may find
interesting and/or useful.
<HR>
EOM
	exit;

© John Blackburne, johnb@hk.super.net, 17th March 1996


up to John's Home Page