⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 amstatus.pl

📁 开源备份软件源码 AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that a
💻 PL
📖 第 1 页 / 共 3 页
字号:
					$error{$hostpart}="";					$dumpers_active--;				}				elsif($line[6] eq "ABORT-FINISHED") {					#7:handle					$serial=$line[7];					$hostpart=$serial{$serial};					$dump_started{$hostpart}=0;					$dump_finished{$hostpart}=0;					$busy_time{$line[5]}+=($current_time-$dump_time{$hostpart});					$running_dumper{$line[5]} = "0";					$dump_time{$hostpart}=$current_time;					$error{$hostpart}="dumper: (aborted)";					$dumpers_active--;				}			}			elsif($line[5] =~ /chunker\d+/) {				if($line[6] eq "DONE" || $line[6] eq "PARTIAL") {					#7:handle 8:size					$serial=$line[7];					$outputsize=$line[8] / $unitdivisor;					$hostpart=$serial{$serial};					$size{$hostpart}=$outputsize;					$dump_finished{$hostpart}=1;					$busy_time{$line[5]}+=($current_time-$chunk_time{$hostpart});					$running_dumper{$line[5]} = "0";					$chunk_time{$hostpart}=$current_time;					$error{$hostpart}="";					if ($line[6] eq "PARTIAL") {						$partial{$hostpart} = 1;					}					else {						$partial{$hostpart} = 0;					}				}				elsif($line[6] eq "FAILED") {					$serial=$line[7];					$hostpart=$serial{$serial};					$dump_finished{$hostpart}=-1;					$busy_time{$line[5]}+=($current_time-$chunk_time{$hostpart});					$running_dumper{$line[5]} = "0";					$chunk_time{$hostpart}=$current_time;					$error{$hostpart}="chunker: " .$line[8] if $error{$hostpart} eq "";				}				elsif($line[6] eq "RQ-MORE-DISK") {					#7:handle					$serial=$line[7];					$hostpart=$serial{$serial};					$dump_roomq{$hostpart}=1;					$error{$hostpart}="(waiting for holding disk space)";				}			}			elsif($line[5] eq "taper") {				if($line[6] eq "DONE" || $line[6] eq "PARTIAL") {					#7:handle 8:label 9:filenum 10:errstr					$serial=$line[7];					$label=$line[8];					$hostpart=$serial{$serial};					$line[10] =~ /sec (\S+) kb (\d+) kps/;					$size=$2 / $unitdivisor;					$taper_finished{$hostpart}=1;					$busy_time{"taper"}+=($current_time-$taper_time{$hostpart});					$taper_time{$hostpart}=$current_time;					if(!defined $size{$hostpart}) {						$size{$hostpart}=$size;					}					$ntpartition{$nb_tape}++;					$ntsize{$nb_tape} += $size{$hostpart} - $ntchunk_size;					if(defined $esize{$hostpart} && $esize{$hostpart} > 1) {						$ntesize{$nb_tape} += $esize{$hostpart} - $ntchunk_size;					}					else {						$ntesize{$nb_tape} += $size{$hostpart} - $ntchunk_size;					}					if ($line[6] eq "PARTIAL") {						$partial{$hostpart} = 1;					}					else {						$partial{$hostpart} = 0;					}					if ($ntchunk_size > 0) {						$ntchunk{$nb_tape}++;					}				}				elsif($line[6] eq "PARTDONE") {					#7:handle 8:label 9:filenum 10:ksize 11:errstr					$serial=$line[7];					$hostpart=$serial{$serial};					#$line[11] =~ /.*kb (\d*) kps/;					#$size=$1 / $unitdivisor;					$size=$line[10] / $unitdivisor;					$tapedsize{$hostpart} += $size;					$ntchunk{$nb_tape}++;					$ntsize{$nb_tape} += $size;					$ntesize{$nb_tape} += $size;					$ntchunk_size += $size;				}				elsif($line[6] eq "REQUEST-NEW-TAPE") {					#7:serial					$serial=$line[7];					$hostpart=$serial{$serial};					if (defined $hostpart) {						$error{$hostpart} = "waiting for a new tape";					}				}				elsif($line[6] eq "NEW-TAPE") {					#7:serial #8:label					$serial=$line[7];					$hostpart=$serial{$serial};					if (defined $hostpart) {						$error{$hostpart} = "";					}				}				elsif($line[6] eq "TRY-AGAIN" || $line[6] eq "TAPE-ERROR") {					#7:handle 8:errstr					$serial=$line[7];					$error=$line[8];					$hostpart=$serial{$serial};					if(defined $hostpart) {						$taper_finished{$hostpart}= $line[6] eq 'TAPE-ERROR' ? -2 : -1;						$busy_time{"taper"}+=($current_time-$taper_time{$hostpart});						$taper_time{$hostpart}=$current_time;						$error{$hostpart}="taper: $error";					}				}				elsif($line[6] eq "FAILED") {					#7:handle 8:INPUT- 9:TAPE- 10:input_message 11:tape_message				   $serial=$line[7];					$hostpart=$serial{$serial};					if(defined $hostpart) {						if($line[9] eq "TAPE-ERROR") {							$error=$line[11];							$taper_finished{$hostpart} = -2;						}						else {							$error=$line[10];							$taper_finished{$hostpart} = -1;						}						$busy_time{"taper"}+=($current_time-$taper_time{$hostpart});						$taper_time{$hostpart}=$current_time;						$error{$hostpart}="$error";					}				}			}		}		elsif($line[1] eq "finished-cmd" && $line[2] eq "time") {			$current_time=$line[3];			if($line[4] =~ /dumper\d+/) {			}		}		elsif($line[1] eq "dump" && $line[2] eq "failed") {			#3:handle 4: 5: 6:"too many dumper retry"			$serial=$line[3];			$hostpart=$serial{$serial};			$dump_started{$hostpart}=-1;			$dump_finished{$hostpart}=-2;			$error{$hostpart} .= "(" . $line[6] . ")";		}		elsif($line[1] eq "tape" && $line[2] eq "failed") {			#3:handle 4: 5: 6:"too many dumper retry"			$serial=$line[3];			$hostpart=$serial{$serial};			$taper_started{$hostpart}=-1;			$taper_finished{$hostpart}=-2;			$error{$hostpart} .= "(" . $line[6] . ")";		}		elsif($line[1] eq "state" && $line[2] eq "time") {			#3:time 4:"free" 5:"kps" 6:free 7:"space" 8:space 9:"taper" 10:taper 11:"idle-dumpers" 12:idle-dumpers 13:"qlen" 14:"tapeq" 15:tapeq 16:"runq" 17:runq 18:"roomq" 19:roomq 20:"wakeup" 21:wakeup 22:"driver-idle" 23:driver-idle			$current_time=$line[3];			$status_taper=$line[10];			$idle_dumpers=$line[12];			$free{"kps"} = $line[6];			$free{"space"} = $line[8];			$qlen{"tapeq"} = $line[15];			$qlen{"runq"} = $line[17];			$qlen{"roomq"} = $line[19];			if(defined($dumpers_active)) {				if($status_driver ne "") {					$dumpers_active[$dumpers_active_prev]						+=$current_time-$state_time_prev;					$dumpers_held[$dumpers_active_prev]{$status_driver}						+=$current_time-$state_time_prev;				}				$state_time_prev=$current_time;				$dumpers_active_prev=$dumpers_active;				$status_driver=$line[16];				if(! defined($dumpers_held[$dumpers_active]{$status_driver})) {					$dumpers_held[$dumpers_active]{$status_driver}=0;				}			}		}	   elsif($line[1] eq "FINISHED") {			$driver_finished = 1;		}	}	elsif($line[0] eq "dump") {		if($line[1] eq "of" &&			$line[2] eq "driver" &&			$line[3] eq "schedule" &&			$line[4] eq "after" &&			$line[5] eq "start" &&			$line[6] eq "degraded" &&			$line[7] eq "mode") {			$start_degraded_mode=1;		}	}	elsif($line[0] eq "taper") {		if($line[1] eq "slot") {			#2:slot 3:"wrote" 4:"label" 5:corrupted...			$nb_tape++;			$lineX =~ /wrote label `(\S*)'/;			$label = $1;			$ntlabel{$nb_tape} = $label;			$ntpartition{$nb_tape} = 0;			$ntsize{$nb_tape} = 0;			$ntesize{$nb_tape} = 0;		}		elsif($line[1] eq "wrote") {			#1:"wrote" 2:"label" 3:corrupted			$nb_tape++;			$lineX =~ /wrote label `(\S*)'/;			$label = $1;			$ntlabel{$nb_tape} = $label;			$ntpartition{$nb_tape} = 0;			$ntsize{$nb_tape} = 0;			$ntesize{$nb_tape} = 0;		}	}   elsif($line[0] eq "splitting" &&			 $line[1] eq "chunk" &&			 $line[2] eq "that" &&			 $line[3] eq "started" &&			 $line[4] eq "at" &&			 $line[6] eq "after") {		$line[7] =~ /(\d*)kb/;		$size = $1;		$ntchunk{$nb_tape}++;	   $ntsize{$nb_tape} += $size / $unitdivisor;		$ntesize{$nb_tape} += $size / $unitdivisor;		$ntchunk_size += $size / $unitdivisor;	}	else {		#print "Ignoring: $lineX\n";	}}close(AMDUMP);if(defined $current_time) {	for ($d = 0; $d < $#dumpers_active; $d++) {		$the_dumper = "dumper$d";		if(defined($running_dumper{$the_dumper}) &&		   $running_dumper{$the_dumper} ne "0") {			$busy_time{$the_dumper}+=($current_time-$dump_time{$running_dumper{$the_dumper}});		}	}}print "\n";$nb_partition = 0;$epartition = 0;$estsize = 0;$fpartition = 0;$fsize = 0;$wpartition = 0;$wsize = 0;$flpartition = 0;$flsize = 0;$wfpartition = 0;$wfsize = 0;$dtpartition = 0;$dtesize = 0;$dupartition = 0;$dusize = 0;$duesize = 0;$dpartition = 0;$dsize = 0;$desize = 0;$twpartition = 0;$twsize = 0;$twesize = 0;$tapartition = 0;$tasize = 0;$taesize = 0;$tfpartition = 0;$tfsize = 0;$tfesize = 0;$tpartition = 0;$tsize = 0;$tesize = 0;$maxnamelength = 10;foreach $host (sort @hosts) {	foreach $partition (sort @$host) {		foreach $datestamp (sort @datestamp) {			$hostpart=&make_hostpart($host,$partition,$datestamp);			next if(!defined $estimate{$hostpart} && !defined $flush{$hostpart});			if(length("$host:$partition") > $maxnamelength) {				$maxnamelength = length("$host:$partition");			}		}	}}foreach $host (sort @hosts) {	foreach $partition (sort @$host) {	   foreach $datestamp (sort @datestamp) {			$hostpart=&make_hostpart($host,$partition,$datestamp);			next if(!defined $estimate{$hostpart} && !defined $flush{$hostpart});			$nb_partition++;			if( (!defined $size{$hostpart} || $size{$hostpart} == 0) &&				 defined $holding_file{$hostpart}) {				$size{$hostpart} = &dump_size($holding_file{$hostpart}) / (1024 * $unitdivisor);			}			$in_flush=0;			if($estimate_done != 1 && !defined $flush{$hostpart}) {				if(defined $estimate{$hostpart}) {					if($estimate{$hostpart} != 1) {						if( defined $opt_gestimate) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s", "$host:$partition";							print "              getting estimate\n";						}					}					else {						if(defined $opt_estimate ||							(defined $opt_gestimate && $partialestimate{$hostpart} == 1)) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s", "$host:$partition";							printf "%2d ",  $level{$hostpart};							printf "%9d$unit", $esize{$hostpart};							if($partialestimate{$hostpart} == 1) {								print " partial";							}							print " estimate done\n";						}						$epartition++;						$estsize += $esize{$hostpart};					}				}			}			else {				if(defined $estimate{$hostpart}) {					if($estimate{$hostpart} == 1) {						$epartition++;						$estsize += $esize{$hostpart};					}					elsif (!defined $dump_started{$hostpart} || $dump_started{$hostpart} == 0) {						if( defined $opt_failed) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};							printf "           no estimate\n";						}						$exit_status |= $STATUS_FAILED;						$fpartition++;						$fsize+=$esize{$hostpart};					}				}				else {					$flpartition++;					$flsize += $size{$hostpart};					$in_flush=1;				}				if(defined $taper_started{$hostpart} &&						$taper_started{$hostpart}==1) {					if(defined $dump_started{$hostpart}) {						$dpartition++;						if(defined($size{$hostpart})) {							$dsize += $size{$hostpart};						}						else {							$dsize += $esize{$hostpart};						}						$desize += $esize{$hostpart};					}					if(defined $dump_started{$hostpart} &&					   	$dump_started{$hostpart} == 1 &&							$dump_finished{$hostpart} == -1) {						if(defined $opt_failed) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};							printf "%9d$unit", $esize{$hostpart};							print " dump to tape failed: " . $error{$hostpart};							print "\n";						}						$exit_status |= $STATUS_FAILED;						$fpartition++;						$fsize+=$esize{$hostpart};					} elsif(defined $dump_started{$hostpart} &&					   	$dump_started{$hostpart} == 1 &&							$dump_finished{$hostpart} == 0 &&							$taper_started{$hostpart} == 1) {						if( defined $opt_dumpingtape ) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};							printf "%9d$unit", $esize{$hostpart};							print " dumping to tape";							if( defined $starttime ) {								print " (", &showtime($taper_time{$hostpart}), ")";							}							print "\n";						}						$dtpartition++;						$dtesize += $esize{$hostpart};					}					elsif($taper_finished{$hostpart} == 0) {						if( defined $opt_writingtape ) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};							printf "%9d$unit", $size{$hostpart};							if($in_flush == 0) {								print " writing to tape";							}							else {								print " flushing to tape";							}							if(defined($tapedsize{$hostpart})) {								printf " (%d$unit done)", $tapedsize{$hostpart};							}							if( defined $starttime ) {								print " (", &showtime($taper_time{$hostpart}), ")";							}							print ", ", $error{$hostpart} if defined($error{$hostpart} &&																	   $error{$hostpart} ne "");							print "\n";						}						$tapartition++;						$tasize += $size{$hostpart};						if(defined $esize{$hostpart}) {							$taesize += $esize{$hostpart};						}						else {							$taesize += $size{$hostpart};						}					}					elsif($taper_finished{$hostpart} < 0) {						if(defined $size{$hostpart}) {							$xsize = $size{$hostpart};						}						elsif(defined $esize{$hostpart}) {							$xsize = $esize{$hostpart};						}						else {							$xsize = 0;						}						if(defined $esize{$hostpart}) {							$exsize += $esize{$hostpart};						}						else {							$exsize += $xsize;						}						if( defined $opt_failed  ||							 (defined $opt_waittaper && ($taper_finished{$hostpart} == -1))) {							printf "%8s ", $datestamp if defined $opt_date;							printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};							printf "%9d$unit", $xsize;							if($in_flush == 0) {								print " failed to tape";							}							else {								print " failed to flush";							}							print ": ",$error{$hostpart} if defined $error{$hostpart};													print " (will retry)" unless $taper_finished{$hostpart} < -1;							if( defined $starttime ) {								print " (", &showtime($taper_time{$hostpart}), ")";							}							print "\n";						}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -