Listing 3: promon.pl
Here is the Perl script that formats output from the promon.exp script:
-------------------------------------------------------------------
#!/bin/perl
# promon.pl
format STDOUT_TOP =
@<<<<<<<<<<<<<<<< Database Activity Report Page
@>>
$date, $%
Physical Logical
Date/Time Users DB Writes Updates Creates Deletes DB Writes
----------- -------- -------- ------- -------- ------- ---------
..
format STDOUT =
@<<<<<<< @<<<<<<< @>>>>>>>>
@>>>>>>>> @>>>>>>>> @>>>>>>>>
@>>>>>>>> @>>>>>>>>
$date_stamp, $time_stamp, $user_count, $db_writes, $rec_updates, \
$rec_creates, $rec_deletes, $logical_writes
..
$date = qx(date '+%D %I:%M %p');
$file = $ARGV[0] || die "no file\n";
open (infile, $file);
while (<infile>)
{
chop;
($date_stamp, $time_stamp, $user_count, $db_writes, \
$rec_updates, $rec_creates, $rec_deletes, $logical_writes) = \
split; write;
}
close (infile);
print "\nEnd of Report.\n";
exit 0;
#
# promon.pl ends here
# End of File
|