GeneralInfo.pm (BackupPC-4.3.2) | : | GeneralInfo.pm (BackupPC-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
# | # | |||
# Version 4.3.2, released 17 Feb 2020. | # Version 4.4.0, released 20 Jun 2020. | |||
# | # | |||
# See http://backuppc.sourceforge.net. | # See http://backuppc.sourceforge.net. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
package BackupPC::CGI::GeneralInfo; | package BackupPC::CGI::GeneralInfo; | |||
use strict; | use strict; | |||
use BackupPC::CGI::Lib qw(:all); | use BackupPC::CGI::Lib qw(:all); | |||
skipping to change at line 52 | skipping to change at line 52 | |||
{ | { | |||
GetStatusInfo("info jobs hosts queueLen"); | GetStatusInfo("info jobs hosts queueLen"); | |||
my $Privileged = CheckPermission(); | my $Privileged = CheckPermission(); | |||
my($jobStr, $statusStr); | my($jobStr, $statusStr); | |||
foreach my $host ( sort(keys(%Jobs)) ) { | foreach my $host ( sort(keys(%Jobs)) ) { | |||
my $startTime = timeStamp2($Jobs{$host}{startTime}); | my $startTime = timeStamp2($Jobs{$host}{startTime}); | |||
next if ( $host eq $bpc->scgiJob ); | next if ( $host eq $bpc->scgiJob ); | |||
next if ( !$Privileged && !CheckPermission($host) ); | next if ( !$Privileged && !CheckPermission($host) ); | |||
$Jobs{$host}{type} = $Status{$host}{type} | $Jobs{$host}{type} = $Status{$host}{type} | |||
if ( $Jobs{$host}{type} eq "" && defined($Status{$host})); | if ( $Jobs{$host}{type} eq "" && defined($Status{$host}) ); | |||
(my $cmd = $Jobs{$host}{cmd}) =~ s/$BinDir\///g; | (my $cmd = $Jobs{$host}{cmd}) =~ s/$BinDir\///g; | |||
(my $xferPid = $Jobs{$host}{xferPid}) =~ s/,/, /g; | (my $xferPid = $Jobs{$host}{xferPid}) =~ s/,/, /g; | |||
$jobStr .= <<EOF; | $jobStr .= <<EOF; | |||
<tr><td class="border"> ${HostLink($host)} </td> | <tr><td class="border"> ${HostLink($host)} </td> | |||
<td align="center" class="border"> $Jobs{$host}{type} </td> | <td align="center" class="border"> $Jobs{$host}{type} </td> | |||
<td align="center" class="border"> ${UserLink(defined($Hosts->{$host}) | <td align="center" class="border"> ${UserLink(defined($Hosts->{$host}) | |||
? $Hosts->{$host}{user} : "")} </td> | ? $Hosts->{$host}{user} : "")} </td> | |||
<td class="border" data-date_format="$Conf{CgiDateFormatMMDD}"> $startTime < /td> | <td class="border" data-date_format="$Conf{CgiDateFormatMMDD}"> $startTime < /td> | |||
<td class="border"> $cmd </td> | <td class="border"> $cmd </td> | |||
<td align="center" class="border"> $Jobs{$host}{pid} </td> | <td align="center" class="border"> $Jobs{$host}{pid} </td> | |||
<td align="center" class="border"> $xferPid </td> | <td align="center" class="border"> $xferPid </td> | |||
<td align="center" class="border"> $Jobs{$host}{xferState} </td> | <td align="center" class="border"> $Jobs{$host}{xferState} </td> | |||
<td align="center" class="border"> $Jobs{$host}{xferFileCnt} </td> | <td align="center" class="border"> $Jobs{$host}{xferFileCnt} </td> | |||
EOF | EOF | |||
$jobStr .= "</tr>\n"; | $jobStr .= "</tr>\n"; | |||
} | } | |||
foreach my $host ( sort(keys(%Status)) ) { | foreach my $host ( sort(keys(%Status)) ) { | |||
next if ( $Status{$host}{reason} ne "Reason_backup_failed" | next | |||
&& $Status{$host}{reason} ne "Reason_restore_failed" | if ( | |||
&& (!$Status{$host}{userReq} | $Status{$host}{reason} ne "Reason_backup_failed" | |||
|| $Status{$host}{reason} ne "Reason_no_ping") ); | && $Status{$host}{reason} ne "Reason_restore_failed" | |||
&& ( !$Status{$host}{userReq} | ||||
|| $Status{$host}{reason} ne "Reason_no_ping") | ||||
); | ||||
next if ( !$Privileged && !CheckPermission($host) ); | next if ( !$Privileged && !CheckPermission($host) ); | |||
my $startTime = timeStamp2($Status{$host}{startTime}); | my $startTime = timeStamp2($Status{$host}{startTime}); | |||
my($errorTime, $XferViewStr); | my($errorTime, $XferViewStr); | |||
if ( $Status{$host}{errorTime} > 0 ) { | if ( $Status{$host}{errorTime} > 0 ) { | |||
$errorTime = timeStamp2($Status{$host}{errorTime}); | $errorTime = timeStamp2($Status{$host}{errorTime}); | |||
} | } | |||
if ( -f "$TopDir/pc/$host/SmbLOG.bad" | if ( -f "$TopDir/pc/$host/SmbLOG.bad" | |||
|| -f "$TopDir/pc/$host/SmbLOG.bad.z" | || -f "$TopDir/pc/$host/SmbLOG.bad.z" | |||
|| -f "$TopDir/pc/$host/XferLOG.bad" | || -f "$TopDir/pc/$host/XferLOG.bad" | |||
|| -f "$TopDir/pc/$host/XferLOG.bad.z" | || -f "$TopDir/pc/$host/XferLOG.bad.z" ) { | |||
) { | ||||
$XferViewStr = <<EOF; | $XferViewStr = <<EOF; | |||
<a href="$MyURL?action=view&type=XferLOGbad&host=${EscURI($host)}">$Lang->{XferL OG}</a>, | <a href="$MyURL?action=view&type=XferLOGbad&host=${EscURI($host)}">$Lang->{XferL OG}</a>, | |||
<a href="$MyURL?action=view&type=XferErrbad&host=${EscURI($host)}">$Lang->{Error s}</a> | <a href="$MyURL?action=view&type=XferErrbad&host=${EscURI($host)}">$Lang->{Error s}</a> | |||
EOF | EOF | |||
} else { | } else { | |||
$XferViewStr = ""; | $XferViewStr = ""; | |||
} | } | |||
(my $shortErr = $Status{$host}{error}) =~ s/(.{48}).*/$1.../; | (my $shortErr = $Status{$host}{error}) =~ s/(.{48}).*/$1.../; | |||
$statusStr .= <<EOF; | $statusStr .= <<EOF; | |||
<tr><td class="border"> ${HostLink($host)} </td> | <tr><td class="border"> ${HostLink($host)} </td> | |||
<td align="center" class="border"> $Status{$host}{type} </td> | <td align="center" class="border"> $Status{$host}{type} </td> | |||
<td align="center" class="border"> ${UserLink(defined($Hosts->{$host}) | <td align="center" class="border"> ${UserLink(defined($Hosts->{$host}) | |||
? $Hosts->{$host}{user} : "")} </td> | ? $Hosts->{$host}{user} : "")} </td> | |||
<td align="right" class="border" data-date_format="$Conf{CgiDateFormatMMDD}" > $startTime </td> | <td align="right" class="border" data-date_format="$Conf{CgiDateFormatMMDD}" > $startTime </td> | |||
<td class="border"> $XferViewStr </td> | <td class="border"> $XferViewStr </td> | |||
<td align="right" class="border" data-date_format="$Conf{CgiDateFormatMMDD}" > $errorTime </td> | <td align="right" class="border" data-date_format="$Conf{CgiDateFormatMMDD}" > $errorTime </td> | |||
<td class="border"> ${EscHTML($shortErr)} </td></tr> | <td class="border"> ${EscHTML($shortErr)} </td></tr> | |||
EOF | EOF | |||
} | } | |||
my $now = timeStamp2(time); | my $now = timeStamp2(time); | |||
my $nextWakeupTime = timeStamp2($Info{nextWakeup}); | my $nextWakeupTime = timeStamp2($Info{nextWakeup}); | |||
my $DUlastTime = timeStamp2($Info{DUlastValueTime}); | my $DUlastTime = timeStamp2($Info{DUlastValueTime}); | |||
my $DUmaxTime = timeStamp2($Info{DUDailyMaxTime}); | my $DUmaxTime = timeStamp2($Info{DUDailyMaxTime}); | |||
my $DUInodemaxTime = timeStamp2($Info{DUInodeDailyMaxTime}); | my $DUInodemaxTime = timeStamp2($Info{DUInodeDailyMaxTime}); | |||
my $numBgQueue = $QueueLen{BgQueue}; | my $numBgQueue = $QueueLen{BgQueue}; | |||
my $numUserQueue = $QueueLen{UserQueue}; | my $numUserQueue = $QueueLen{UserQueue}; | |||
my $numCmdQueue = $QueueLen{CmdQueue}; | my $numCmdQueue = $QueueLen{CmdQueue}; | |||
my $serverStartTime = timeStamp2($Info{startTime}); | my $serverStartTime = timeStamp2($Info{startTime}); | |||
my $configLoadTime = timeStamp2($Info{ConfigLTime}); | my $configLoadTime = timeStamp2($Info{ConfigLTime}); | |||
my $poolInfo = genPoolInfo("pool4", "pool", \%Info); | my $poolInfo = genPoolInfo("pool4", "pool", \%Info); | |||
my $cpoolInfo = genPoolInfo("cpool4", "cpool", \%Info); | my $cpoolInfo = genPoolInfo("cpool4", "cpool", \%Info); | |||
if ( $Info{pool4FileCnt} > 0 && $Info{cpool4FileCnt} > 0 ) { | if ( $Info{pool4FileCnt} > 0 && $Info{cpool4FileCnt} > 0 ) { | |||
$poolInfo = <<EOF; | $poolInfo = <<EOF; | |||
<li>Uncompressed pool: | <li>Uncompressed pool: | |||
<ul> | <ul> | |||
$poolInfo | $poolInfo | |||
</ul> | </ul> | |||
<li>Compressed pool: | <li>Compressed pool: | |||
<ul> | <ul> | |||
$cpoolInfo | $cpoolInfo | |||
</ul> | </ul> | |||
EOF | EOF | |||
} elsif ( $Info{cpool4FileCnt} > 0 ) { | } elsif ( $Info{cpool4FileCnt} > 0 ) { | |||
$poolInfo = $cpoolInfo; | $poolInfo = $cpoolInfo; | |||
} | } | |||
my $generalInfo = ""; | my $generalInfo = ""; | |||
if ( $Privileged ) { | if ( $Privileged ) { | |||
$generalInfo = eval("qq{$Lang->{BackupPC_Server_Status_General_Info}}") ; | $generalInfo = eval("qq{$Lang->{BackupPC_Server_Status_General_Info}}"); | |||
if ( -r "$LogDir/poolUsage4.png" && -r "$LogDir/poolUsage52.png" ) { | if ( -r "$LogDir/poolUsage4.png" && -r "$LogDir/poolUsage52.png" ) { | |||
$generalInfo .= <<EOF; | $generalInfo .= <<EOF; | |||
<ul> | <ul> | |||
<ul> | <ul> | |||
<p><img src="$MyURL?action=view&type=poolUsage&num=4"> | <p><img src="$MyURL?action=view&type=poolUsage&num=4"> | |||
<p><img src="$MyURL?action=view&type=poolUsage&num=52"> | <p><img src="$MyURL?action=view&type=poolUsage&num=52"> | |||
</ul> | </ul> | |||
</ul> | </ul> | |||
EOF | EOF | |||
} | } | |||
End of changes. 7 change blocks. | ||||
15 lines changed or deleted | 19 lines changed or added |