#!/usr/bin/perl 
##########################################################
# File: ASM_monitor.pl					 #
# Date: 08/2005                                          #
# Usage: For Enterprise ASM storage system.              #
# Purpose: Will allow Ops to proactivly monitor ASM tape #
# pools for archival purposes.			         #
# By: Derek Smith                                        #
# OhioHealth Unix Support                                #
# Phyllis Mendoza, Derek Smith, Tom Blaney               #
##########################################################

use strict;
use warnings;
use CGI qw(:standard), (-unique_headers);
use CGI::Carp qw(fatalsToBrowser);
use MIME::Lite ();
our $flag=0;
my $time = localtime;
$ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin);
delete @ENV{qw (IFS CDPATH BASH_ENV) };
$| =1; ##-- Turn off buffering --##


##-- BEGIN ROUTINES --##


	sub error
	{
		my ($q, $error_messg) = @_;
		print 	$q->header,
			$q->start_html("ASM CGI Page Error"),
			$q->h1("ASM CGI Page Error"),
			$q->p("The following Error has occurred when retrieving ASM data via CGI to your browser:"),
			$q->p($q->i($error_messg) ),
			$q->end_html;
		exit;
	}

        sub mailme
        {
		my $sub = shift;
                my $msg = MIME::Lite->new(
                From    => 'stkv440 <root@stkv440.ohnet>',
                To      => 'OHIS Ops <oper1@ohiohealth.com>',
		#To	=> 'Derek <dbsmith@ohiohealth.com>',
                Subject => 'ASM Tape Pool Notification',
		Data	=> "$sub");
		$msg->send;
        }

			


##-- BEGIN MAIN CGI ##--##

my $q = new CGI;
print 	$q->header,
	$q->start_html ('OhioHealth I.S. ASM server: stkv440'),				# Header
	$q->h1 ({-style=>'Color:blue'},'OhioHealth ASM Tape Pool Status:');		# Body

##-- Print the 1st form --##

print $q->hr; 

print $q->startform;

print "<P><H3>Please Select an ASM Client View Below. </P></H3>",

$q->radio_group

	( -name=>'view',
	-value=>[qw{All-Clients Backup-Tapes PACS-Fuji Heartlab StreamLine-Health}],
	-linebreak=>'true', -attributes=>\my %attributes),
	$q->defaults(-name=>'Default'),$q->submit('form','Send Form'
	);
		my $which_radio_button = $q->param('view') || '';
		if ( $which_radio_button eq 'All-Clients' )
		{
			&viewall();        	

			sub viewall
			{
				open (ARC, "archiver -v |") or do &error();
        			while (<ARC>)
        			{
                			print "<H3>";
                                        if (/\A(?i)fs_clinical\.1/ .. /\A(?i)heartlab\.1/ )
                                        {
                                                if (/\A(?i)heartlab\.1/)
                                                {
                                                        s<heartlab.1><>;
                                                }
							if (/(?i)total space available:/)
							{
								print "<p><b><font color=#0000CC><u>$_";
							} else {
								print "<p></b></font></u>$_";
							}
                                        }

                                }

        			close (ARC) or warn "Was unable to close FH at line 104 $!";
				print "<P></u><b><font color=#0000CC>",$time,"</P></H3></b></font>";

			} ##-- END ROUTINE viewall -- ##
		} 
		elsif ($which_radio_button eq 'Backup-Tapes')
		{
			&viewbkups();
			sub viewbkups
			{
				open (ARC, "archiver -v |") or do &error();
                                foreach (<ARC>)
                                {
					print "<H3>";
                                        if (/(?i)back\.1/ .. /(?i)fs_clinical\.1/)
                                        {
						s<fs_clinical.1><>;
						$flag=1;
						
						if ($flag==1)
						{
							if (/(?i)total space available:/)
                                                        {
                                                                print "<p><b><font color=#0000CC><u>$_";
                                                        } else {
                                                                print "<p></b></font></u>$_";
                                                        }
						}
					}

                                	if (/\A(?i)heartlab\.1/ .. /(?i)back\.1/)
                                	{
                                        	s<back.1><>;
						$flag=1;
			
						if (/(?i)total space available:/)
						{
							print "<p><b><font color=#0000CC><u>$_";
						} else {
							print "<p></b></font></u>$_";
						}
					}

                                }  ##-- END FOR LOOP --##

			}	##-- END ROUTINE viewbkups --##
			
			close (ARC) or warn "Was unable to close FH at line 151 $!";
			print "</u><b><p><font color=#0000CC>",$time,"</H3></b></font>";
		}
		elsif ($which_radio_button eq 'PACS-Fuji') 
		{
			&viewpacs();
			my ($F9840vols,$F9940vols) =0;
			sub viewpacs
			{
				open (ARC, "archiver -v |") or do &error();
       			 	foreach (<ARC>)
        			{
					print "<H3>";
                			if (/(?i)fs_clinical\.1/ .. /(?i)fs_heartlab\.1/)
                			{
                        			s<fs_heartlab.1><>;
						$flag=1;
						if ($flag==1)
						{
							if (/(?i)total space available:/)
							{
                        					print "<p><b><font color=#0000CC><u>$_";
							} else {
								print "<p></b></font></u>$_";
							}
						}
                			} ##-- END IF --##

                                        if (/(?i)fs_original\.1/ .. /(?i)heartlab\.1/)
                                        {
                                                s<heartlab.1><>;
                                                $flag=1;
                                                if ($flag==1)
                                                {
                                                        if (/(?i)total space available:/)
                                                        {
                                                                print "<p><b><font color=#0000CC><u>$_";
                                                        } else {
                                                                print "<p></b></font></u>$_";
                                                        }
						}
						if ( /(?i)f01/g )
						{
							$F9840vols++;
						}
                                             
						if ( /(?i)f02/g )
						{
							$F9940vols++;
						}

					} ##-- END IF --##

        			} ##-- END FOR LOOP --##

				close (ARC) or warn "Was unable to close FH at line 206 $!";
				print "<b><font color=#0000CC>",$time,"</b></font>";

                        ##-- BEGIN IMPORT --##
		
                        if ($F9840vols <= 3)
                        {
			   print "<p><b><H2><font color=#CC3300>Fuji Copy1 9840 Pool Is Down To 3 Or Less Tapes!</b></H2></font>";
			   my $sub='Fuji 9840 tape pool only has 3 or less tapes available!';
			   &mailme($sub);
                        }

			&F98import();

			sub F98import
                        {
                                print   $q->h3 ({-style=>'Color:#0000CC'},'Please Choose 9840 Tape Range for Import.'),
                                        $q->h3 ({-style=>'Color:#CC3300'},'Note: Inject Tapes via Acsls Prior To Import!');
                                my @F98tapes =('F01151' .. 'F01999');

##--## Recover the previous tapes from the magic cookie.        ##--##
##--## The cookie has been formatted as an associative array    ##--##
##--## mapping tape id to the number of tapes.                  ##--##

                                my %F98tapes = cookie('tapes');

                                print $q->scrolling_list(-name=>'imported_tapes',
                                        -values=>[@F98tapes],
                                        -override=>1,
                                        -size=>10),"<br>";
                                print   $q->submit(-name=>'action',-value=>'Delete F9840'),
                                        $q->submit(-name=>'action',-value=>'Import F9840');


##-- Recover the new tape(s) from the Scroll List parameter 'imported_tapes' --##

                                my @imports = param('imported_tapes');

##-- First Check is tapes are already in ASM, if tape is present send message to webpage. --##
##-- Then If the action is 'add', then import new tapes, Otherwise delete them from the CGI list. --##

                                open (SAM, "samcmd v4 800|") or die "Was unable to talk to ASM for pre tape import line 247", &error($!);
				my $which_import = $q->param('action') || '';

                               foreach my $scalar (@imports)
                               {
                                   if ($which_import eq 'Import F9840')
                                   {
                                      while (<SAM>)
                                      {
                                        if (/(?i)$scalar/g)
                                        {
                                           my $ns=substr($_, 50);
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $ns, 'is already in ASM.',"\n");
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n");
                                           exit;
                                        }
                                      }  ##-- END WHILE --##

                                      close (SAM) or warn "Was unable to close FH at line 265 $!";

                                      $F98tapes{$scalar}++;
                                      sleep 1;
                                      print "\tNow Importing:\n";
                                      system("import -v $scalar 800"); #or do &error($!);
				      open (IMPORTLOG,">>/usr/local/log/import.log") or warn "Unable to open import log", &error($!);
				      print IMPORTLOG "Tape:\t", $scalar, "\twas imported to ASM 800 db\t", $time,"\n";
				      close (IMPORTLOG) or warn "Unable to close import log", &error($!);
                                  }
                                  elsif (param('action') eq 'Delete F9840')
                                  {
					print "ASM F9840 Removed From Temporary Import List";
                                        $F98tapes{$scalar}-- if $F98tapes{$scalar};
                                        delete $F98tapes{$scalar} unless $F98tapes{$scalar};
                                  }

				} ##-- END FOR LOOP line 282 --##

##-- Add new tapes to old, and put them in a cookie --##

                                my $the_cookie = cookie(-name=>'tapes',
                                -value=>\%F98tapes,
                                -expires=>"+15m",
                                -path=>"/var/apache/cgi-bin");

                                print "<td>";
                                if (%F98tapes ne 'undef')  ##-- Make A Table --##
                                {
                                        print "<ul>\n";
                                        foreach (sort keys %F98tapes)
                                        {
                                                print "<li>$F98tapes{$_} $_\n</li>";
                                        }
                                        print "</ul>\n";

                                } else {
                                        print "<strong>\tImport List Is Empty.</strong>\n";
                                }
                                print "</td></center>";

                        } ##-- END ROUTINE F98import --##

                        if ($F9940vols <= 3)
                        {
			   print "<p><b><H2><font color=#CC3300>Fuji Copy2 9940 Pool Is Down To 2 Or Less Tapes!</b></H2></font>";
			   my $sub='Fuji 9940 tape pool only has 3 or less tapes available!';
                           &mailme($sub);
                        }

			&F99import();

		        sub F99import
                        {
                        	print   $q->h3 ({-style=>'Color:#0000CC'},'Please Choose 9940 Tape Range for Import.'),
                                        $q->h3 ({-style=>'Color:#CC3300'},'Note: Inject Tapes via Acsls Prior To Import!');
                                my @F99tapes =('F02037' .. 'F02999');

##--## Recover the previous tapes from the magic cookie.        ##--##
##--## The cookie has been formatted as an associative array    ##--##
##--## mapping tape id to the number of tapes.                  ##--##

                                my %F99tapes = cookie('tapes');

                                print $q->scrolling_list(-name=>'imported_tapes',
                                        -values=>[@F99tapes],
                                        -override=>1,
                                        -size=>10),"<br>";
                                print   $q->submit(-name=>'action',-value=>'Delete F9940'),
                                        $q->submit(-name=>'action',-value=>'Import F9940');


##-- Recover the new tape(s) from the Scroll List parameter 'imported_tapes' --##

                                my @imports = param('imported_tapes');

##-- First Check is tapes are already in ASM, if tape is present send message to webpage. --##
##-- Then If the action is 'add', then import new tapes, Otherwise delete them from the CGI list. --##

                                open (SAM, "samcmd v4 900|") or die "Was unable to talk to ASM for pre tape import line 344",&error($!);
                                open (SAM9, "samcmd v4 999|") or die "Was unable to talk to ASM for pre tape import line 345",&error($!);
			  	my $which_import = $q->param('action') || '';

                               foreach my $scalar (@imports)
                               {
                                   if ($which_import eq 'Import F9940')
                                   {
                                      while (<SAM>)
                                      {
                                        if (/(?i)$scalar/g)
                                        {
                                           my $ns=substr($_, 50);
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $ns, 'is already in ASM.',"\n");
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n");
                                           exit;
                                        }

                                      } ##-- END WHILE line 362 --##

                                      close (SAM) or warn "Was unable to close FH at line 364 $!";

                                      while (<SAM9>)
                                      {
                                        if (/(?i)$scalar/g)
                                        {
                                           my $nss=substr($_, 50);
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $nss, 'was already exported from ASM.',"\n");
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n");
                                           exit;
                                        }

                                      } ##-- END WHILE line 376 --##

                                      close (SAM9) or warn "Was unable to close FH at line 378 $!";

                                      $F99tapes{$scalar}++;
                                      sleep 1;
                                      print "\tNow Importing:\n";
                                      system("import -v $scalar 900"); #or do &error($!);
				      open (IMPORTLOG,">>/usr/local/log/import.log") or warn "Unable to open import log", &error($!);
                                      print IMPORTLOG "Tape:\t", $scalar, "\twas imported to ASM 900 db\t", $time,"\n";
                                      close (IMPORTLOG) or warn "Unable to close import log", &error($!);

                                   }  ##-- END IF line 388 --##

                                   elsif (param('action') eq 'Delete F9940')
                                   {
					print "ASM F9940 Removed From Temporary Import List";
                                        $F99tapes{$scalar}-- if $F99tapes{$scalar};
                                        delete $F99tapes{$scalar} unless $F99tapes{$scalar};
                                   }

                               } ##-- END FOR LOOP line 397 --##

##-- Add new tapes to old, and put them in a cookie --##

                                my $the_cookie = cookie(-name=>'tapes',
                                -value=>\%F99tapes,
                                -expires=>"+15m",
                                -path=>"/var/apache/cgi-bin");

                                print "<td>";
                                if (%F99tapes ne 'undef')  ##-- Make A Table --##
                                {
                                        print "<ul>\n";
                                        foreach (sort keys %F99tapes)
                                        {
                                                print "<li>$F99tapes{$_} $_\n</li>";
                                        }
                                        print "</ul>\n";

                                } else {
                                        print "<strong>\tImport List Is Empty.</strong>\n";
                                }
                                print "</td></center>";

				} ##-- END IF ELSE --##

			} ##-- END ROUTINE F99import --##

		} ##-- END ROUTINE viewpacs --##
		
		elsif ($which_radio_button eq 'Heartlab')
		{
			&viewhrtlab();
			my ($H9840vols,$H9940vols) =0;
			sub viewhrtlab
			{
				open (ARC, "archiver -v |") or do &error();
        			foreach (<ARC>)
        			{
					print "<H3>";
                			if (/(?i)fs_heartlab\.1/ .. /(?i)fs_lanv1.1/)
                			{
                        			s<fs_lanv1.1><>;
						$flag=1;
						if ($flag==1)
						{
							if (/(?i)total space available:/)
							{
                        					print "<p><b><font color=#0000CC><u>$_";
							} else {
								print "<p></b></font></u>$_";
							}
						}
						if ( /(?i)h01/g )
						{
							$H9840vols++;
						}
						if ( /(?i)h02/g )
						{
							$H9940vols++;
						}
                			} ##-- END IF LINE 458 --##

        			} ##-- EMD FORLOOP LINE 460 --##

				close (ARC) or warn "Was unable to close FH at line 462 $!";
				print "<b><font color=#0000CC>",$time,"</H3></b></font>";

			##-- BEGIN IMPORT --##
		
			if ($H9840vols <= 3)
			{
			   print "<p><b><H2><font color=#CC3300>Heartlab Copy1 9840 Pool Is Down To 3 Or Less Tapes!</b></H2></font>";
			   my $sub='Heartlab 9840 tape pool only has 3 or less tapes available!';
                           &mailme($sub);
			}

			&H98import();

			sub H98import
                        {
                                print   $q->h3 ({-style=>'Color:#0000CC'},'Please Choose 9840 Tape Range for Import.'),
                                        $q->h3 ({-style=>'Color:#CC3300'},'Note: Inject Tapes via Acsls Prior To Import!');
                                my @H98tapes =('H01053' .. 'H01059', 'H01174' .. 'H01999');

##--## Recover the previous tapes from the magic cookie.        ##--##
##--## The cookie has been formatted as an associative array    ##--##
##--## mapping tape id to the number of tapes.                  ##--##

                                my %H98tapes = cookie('tapes');

                                print $q->scrolling_list(-name=>'imported_tapes',
                                        -values=>[@H98tapes],
                                        -override=>1,
                                        -size=>10),"<br>";
                                print   $q->submit(-name=>'action',-value=>'Delete H9840'),
                                        $q->submit(-name=>'action',-value=>'Import H9840');


##-- Recover the new tape(s) from the Scroll List parameter 'imported_tapes' --##

                                my @imports = param('imported_tapes');

##-- First Check is tapes are already in ASM, if tape is present send message to webpage. --##
##-- Then If the action is 'add', then import new tapes, Otherwise delete them from the CGI list. --##

                                open (SAM, "samcmd v4 800|") or die "Was unable to talk to ASM for pre tape import line 503",&error($!);
				my $which_import = $q->param('action') || '';

                                foreach my $scalar (@imports)
                                {
                                   if ($which_import eq 'Import H9840')
                                   {
                                      while (<SAM>)
                                      {
                                        if (/(?i)$scalar/g)
                                        {
                                           my $ns=substr($_, 50);
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $ns, 'is already in ASM.',"\n");
                                           print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n");
                                           exit;
                                        }
                                      } ##-- END WHILE --##

                                      close (SAM) or warn "was unable to close FH at line 521 $!";

                                      $H98tapes{$scalar}++;
                                      sleep 1;
                                      print "\tNow Importing:\n";
                                      system("import -v $scalar 800"); #or do &error($!);
				      open (IMPORTLOG,">>/usr/local/log/import.log") or warn "Unable to open import log", &error($!);
                                      print IMPORTLOG "Tape:\t", $scalar, "\twas imported to ASM 800 db\t", $time,"\n";
                                      close (IMPORTLOG) or warn "Unable to close import log", &error($!);

                                  }
                                  elsif (param('action') eq 'Delete H9840')
                                  {
					print "ASM H9840 Removed From Temporary Import List";
                                        $H98tapes{$scalar}-- if $H98tapes{$scalar};
                                        delete $H98tapes{$scalar} unless $H98tapes{$scalar};
                                  }

                                } ##-- END FOR LOOP LINE 539 --##

##-- Add new tapes to old, and put them in a cookie --##

                                my $the_cookie = cookie(-name=>'tapes',
                                -value=>\%H98tapes,
                                -expires=>"+15m",
                                -path=>"/var/apache/cgi-bin");

                                print "<td>";
                                if (%H98tapes ne 'undef')  ##-- Make A Table --##
                                {
                                        print "<ul>\n";
                                        foreach (sort keys %H98tapes)
                                        {
                                                print "<li>$H98tapes{$_} $_\n</li>";
                                        }
                                        print "</ul>\n";

                                } else {
                                        print "<strong>\tImport List Is Empty.</strong>\n";
                                }
                                print "</td></center>";

			   } ##-- END ROUTINE H98import --##

			
			if ($H9940vols <= 3)
			{
			   print "<p><b><H2><font color=#CC3300>Heartlab Copy2 9940 Pool Is Down To 2 Or Less Tapes!</b></H2></font>";
			   my $sub='Heartlab 9940 tape pool only has 3 or less tapes available!';
                           &mailme($sub);
			}	

			&H99import();

			sub H99import 
			{
				print	$q->h3 ({-style=>'Color:#0000CC'},'Please Choose 9940 Tape Range for Import.'),
			 		$q->h3 ({-style=>'Color:#CC3300'},'Note: Inject Tapes via Acsls Prior To Import!');
				my @H99tapes =('H02043' .. 'H02999');

##--## Recover the previous tapes from the magic cookie.	##--##
##--## The cookie has been formatted as an associative array	##--##
##--## mapping tape id to the number of tapes. 			##--##

				my %H99tapes = cookie('tapes');

				print $q->scrolling_list(-name=>'imported_tapes',
                        		-values=>[@H99tapes],
                        		-override=>1,
                        		-size=>10),"<br>";
				print   $q->submit(-name=>'action',-value=>'Delete H9940'),
        				$q->submit(-name=>'action',-value=>'Import H9940');


##-- Recover the new tape(s) from the Scroll List parameter 'imported_tapes' --##

				my @imports = param('imported_tapes');

##-- First Check is tapes are already in ASM, if tape is present send message to webpage. --##
##-- Then If the action is 'add', then import new tapes, Otherwise delete them from the CGI list. --##

				open (SAM, "samcmd v4 900|") or die "Was unable to talk to ASM for tape import; line 602",&error($!);
				open (SAM9, "samcmd v4 999|") or die "Was unable to talk to ASM for tape import; line 603",&error($!);
				my $which_import = $q->param('action') || '';

				foreach my $scalar (@imports) 
				{
				   if ($which_import eq 'Import H9940')
                                   {
				      while (<SAM>)
				      {
				   	if (/(?i)$scalar/g)
				  	{
					   my $ns=substr($_, 50);
					   print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $ns, 'is already in ASM.',"\n");
					   print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n");
					   exit;
					}
				      } ##-- END WHILE --##

				      close (SAM) or warn "Was unable to close FH at line 621 $!";
					
				      while (<SAM9>)
				      {
				      	if (/(?i)$scalar/g)
					{
					   my $nss=substr($_, 50);
					   print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $nss, 'was already exported from ASM.',"\n");
					   print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n");
					   exit;
					}
				      } ##-- END WHILE --##

				      close (SAM9) or warn "Was unable to close FH at line 634 $!";

				      $H99tapes{$scalar}++;
                                      sleep 1;
				      print "\tNow Importing:\n";
				      system("import -v $scalar 900"); #or do &error($!);
				      open (IMPORTLOG,">>/usr/local/log/import.log") or warn "Unable to open import log", &error($!);
                                      print IMPORTLOG "Tape:\t", $scalar, "\twas imported to ASM 800 db\t", $time,"\n";
                                      close (IMPORTLOG) or warn "Unable to close import log", &error($!);

                                   }
                                   elsif (param('action') eq 'Delete H9940')
                                   {
					print "ASM H9940 Removed From Temporary Import List";
                                  	$H99tapes{$scalar}-- if $H99tapes{$scalar};
                                       	delete $H99tapes{$scalar} unless $H99tapes{$scalar};
                                   }

			      } ##-- END FOR LOOP LINE 652 --##

##-- Add new tapes to old, and put them in a cookie --##

				my $the_cookie = cookie(-name=>'tapes',
				-value=>\%H99tapes,
				-expires=>"+15m",
				-path=>"/var/apache/cgi-bin");

				print "<td>";
				if (%H99tapes ne 'undef')  ##-- Make A Table --##
				{                     
					print "<ul>\n";
					foreach (sort keys %H99tapes) 
					{
        					print "<li>$H99tapes{$_} $_\n</li>";
					}
    					print "</ul>\n";
	
				} else {
					print "<strong>\tImport List Is Empty.</strong>\n";
				}
				print "</td></center>";	


###########################################################################################################################
#				my @H99tapes =('H02043' .. 'H02999');		##--## MAIN ARRAY 	##--##
#				my @UserH99tapes = @H99tapes;			##--## USER SELECTIONS	##--##
#				$[=0;
				
#				print $q->scrolling_list('htapes99',[@H99tapes],[$H99tapes[0]],10,-multiple=>'true',my %attributes),
#				$q->submit('form','Submit'),
#				$q->reset;

				##--## BEGIN IMPORT							    ##--##
				##--## AS H NUMBERS ARE SELECTED, REMOVE SUBMITTED ELEMENTS FROM USER ARRAY ##--##
                                ##--## REPOPULATE LIST INTO NEW ARRAY, PRINT NEW ARRAY.			    ##--##

#				my @tape_imports_to_del = $q->param(htapes99);	##--## SELECTED BY USER ##--##
#				print @tape_imports_to_del;
#				my $tape_count = scalar @tape_imports_to_del;	##--## COUNT            ##--##

#				foreach (@tape_imports)
#				{
#				splice (@H99tapes,0,$tape_count,@H99tapes)
#				}
				
#				print $q->scrolling_list('htapes99',[@H99tapes],[$H99tapes[0]],10,-multiple=>'true',%attributes);
##################################################################################################################################

				} ##-- END ROUTINE H99import --##

			} ##-- END ROUTINE viewhrtlab --## 
		}
		elsif ($which_radio_button eq 'StreamLine-Health')
		{
			&viewslhlth();
			sub viewslhlth
			{
				open (ARC, "archiver -v |") or do &error();
        			foreach (<ARC>)
        			{
					print "<H3>";
                			if (/(?i)lanvision\.1/ .. /(?i)fs_original\.1/)
                			{
                        			s<fs_original.1><>;
						$flag=1;
						if ($flag==1)
						{
							if (/(?i)total space available:/)
							{
                        					print "<p><b><font color=#0000CC><u>$_";
							} else {
								print "<p></b></font></u>$_";
							}
						}
                			}

        			} ##-- END FOR LOOP --##

				close (ARC) or warn "Was unable to close FH at line 732 $!";
				print "<b><font color=#0000CC>",$time,"</H3></b></font>";

			} ##-- END ROUTINE viewslhlth --##
		}
print $q->hr;
print $q->endform;
print $q->end_html;
