Modified : Dashboard

Added : Migration - VMs Backup
This commit is contained in:
e025532
2024-12-30 12:19:06 +01:00
parent fe0b5f6880
commit 9e6f83b6ec
6 changed files with 782 additions and 58 deletions

175
Hyper-V/Migration.php Normal file
View File

@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title -->
<title>Web Infra Reports IT</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<link rel="stylesheet" href="/css/preloader.css">
<script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head>
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML -->
<div class="container-fluid" id="content">
<div class="row flex-nowrap">
<!-- Left NAVBAR -->
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h2><span class="badge text-bg-secondary " style="width:100%;" >VM Storage (migration phase)</span></h2>
<!-- Main content -->
<div class="container-fluid">
<!-- MODAL WAIT -->
<div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="padding-top: 15%;">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center>
</h4>
</div>
<div class="modal-body">
<div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- TABLE -->
<div>
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="vm">
<thead> <!-- Header -->
<th data-field='vm' data-sortable='true'>VM</th>
<th data-field='Last Backup' data-sortable='true'>Legacy Host</th>
<th data-field='Last Result' data-sortable='true'>Destination Host</th>
<th data-field='Last Good' data-sortable='true'>VHDX Storage</th>
<th data-field='Size' data-sortable='true'>VNX Luns</th>
<th data-field='Host' data-sortable='true'>SVC Luns</th>
</thead>
<tbody> <!-- Body -->
<?php
$answers = Invoke_Infra("SELECT * FROM cmdb_vms where (owner like '%DUN%' or owner like '%mdk%') and owner not like '%VMH-WM%' and owner not like '%WKG%' and DecomTime is null order by name");
$clusters = Invoke_WebInfraTools("select distinct hostname from storage_lun where hostname like '%-c1%'");
$lunsVNX = Invoke_WebInfraTools("select * from storage_lun where baie = 'VNX'");
$lunsSVC = Invoke_WebInfraTools("select * from storage_lun where baie = 'SVC'");
foreach ($answers as $row) {
echo "<tr>";
echo "<td>".$row['Name']."</td>";
if(strpos($row['Owner'],"SYN") !== false || strpos($row['Owner'],"MIG") !== false){
echo "<td></td><td>".$row['Owner']."</td>";
}else{
echo "<td>".$row['Owner']."</td><td></td>";
}
echo "<td>".str_replace(".vhdx,"," : ",str_replace("|","GB<br>",$row['VHDXs']))."GB</td>";
if($row['WWPNs'] != ""){
echo "<td>";
foreach($lunsVNX as $lun){
if($lun['hostname'] == $row['Name']){
echo explode("_",$lun['name'])[1]." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
echo "<td>";
foreach($lunsSVC as $lun){
if($lun['hostname'] == $row['Name']){
echo $lun['name']." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
}else{echo "<td></td><td></td>";}
echo "</tr>";
}
foreach ($clusters as $row) {
$lunsVNX = Invoke_WebInfraTools("select * from storage_lun where baie = 'VNX' and hostname = '".$row['hostname']."' order by name");
$lunsSVC = Invoke_WebInfraTools("select * from storage_lun where baie = 'SVC' and hostname = '".$row['hostname']."' order by name");
echo "<tr>";
echo "<td>".$row['hostname']." (Cluster)</td>";
echo "<td></td><td></td><td></td>";
echo "<td>";
foreach($lunsVNX as $lun){
if($lun['hostname'] == $row['hostname']){
echo explode("_",$lun['name'])[1]." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
echo "<td>";
foreach($lunsSVC as $lun){
if($lun['hostname'] == $row['hostname']){
echo $lun['name']." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
}
echo "</tr>";
?>
</tbody>
</table>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<?php
$ERR = "VMs backups (<span class='text-danger'>".$er." issues</span> - <span class='text-warning'>".$outdated." outdated </span>- <span class='text-info'>".$excluded.' excluded</span>)';
?>
</body>
<script src="/js/switch.js"></script>
</HTML>
<SCRIPT>
$(document).ready(function() {
$('#t1').DataTable({
scrollY: '50vh',
scrollCollapse: true,
paging: false,
});
});
$(function () {
var options = $('#t1').bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options);
});
function tableresize() {
var options = $('#t1').bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options);
};
window.addEventListener("resize", tableresize);
document.getElementById("ERR").innerHTML = "<?php echo $ERR ; ?>";
</script>

View File

@@ -31,10 +31,8 @@
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$answers = Invoke_WebInfraReports("SELECT a.VM, a.LastBackup, a.Result, a.LastGoodBackup, a.Host, b.OS //$answers = Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and Exclusion ='' and LastResult <> 'OK' order by lastresult,name");
FROM netbackup_vms a //$answers += Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and Exclusion <>'' order by name");
left join globalcrossover b on a.VM = b.Server
where a.vm not like 'WS%' and a.vm not like '%vmmsv%' order by a.VM");
?> ?>
<!-- HTML --> <!-- HTML -->
@@ -47,7 +45,7 @@
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;" id="ERR"></span></h1> <h2><span class="badge text-bg-secondary " style="width:100%;" id="ERR"></span></h2>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
@@ -71,57 +69,93 @@
<!-- TABLE --> <!-- TABLE -->
<div> <div>
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM"> <table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM">
<thead> <!-- Header --> <thead> <!-- Header -->
<th data-field='vm' data-sortable='true'>VM</th> <th data-field='vm' data-sortable='true'>VM</th>
<th data-field='Last Backup' data-sortable='true'>Last Backup</th> <th data-field='Last Backup' data-sortable='true'>Last Backup</th>
<th data-field='LastGood' data-sortable='true'>Last Good Backup</th> <th data-field='Last Result' data-sortable='true'>Last Result</th>
<th data-field='OS' data-sortable='true'>OS</th> <th data-field='Last Good' data-sortable='true'>Last Good Backup</th>
<th data-field='Host' data-sortable='true'>Host</th> <th data-field='Size' data-sortable='true'>Size</th>
</thead> <th data-field='Host' data-sortable='true'>Host</th>
<th data-field='Policy' data-sortable='true' data-visible='false'>Policy</th>
</thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
<?php <?php
// NO Backup or Backup with Errors
$er = 0; $er = 0;
$answers = Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and owner not like '%VMH-WM%' and Exclusion ='' and (LastResult <> 'OK' or lastresult is null) order by lastresult,name");
foreach ($answers as $row) { foreach ($answers as $row) {
$ok = 1; $er++;
if($row['LastBackup'] == 0){ $date1 = date_create($row['LastKnownGood']); $diff = date_diff($date1, date_create(date("Y-m-d")));
echo '<tr class="table-primary">'; if ($diff->format("%R%a") >= 2 || $row['LastKnownGood'] == ''){
echo '<td><b>'.$row['VM'].'</b></td>'; echo "<tr class='table-danger'>";
echo '<td>Excluded via VMM</td>';
echo '<td></td><td>'.$row['OS'].'</td><td>'.$row['Host'].'</td>';
}else{ }else{
echo '<tr>'; echo "<tr class='table-warning'>";
$date1 = date_create($row['LastGoodBackup']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 3 || $row['LastGoodBackup'] == ""){
echo '<td class="table-danger"><b>'.$row['VM'].'</b></td>';
$ok = 0;
}else{
echo '<td class="table-success"><b>'.$row['VM'].'</b></td>';
}
if($row['Result'] === "0"){
echo '<td class="table-success">OK</td>';
}else{
$ok = 0;
if($row['Result'] == " : FAILED"){
echo '<td class="table-danger"> SNAPSHOT FAILED</td>';
}else{
echo '<td class="table-warning"> ERROR '.$row['Result'].'</td>';
}
}
if ($diff->format("%R%a") > 3 || $row['LastGoodBackup'] == ""){
echo '<td class="table-danger">'.$row['LastGoodBackup'].'</td>';
$ok = 0;
}else{
echo '<td class="table-success">'.$row['LastGoodBackup'].'</td>';
}
echo '<td>'.$row['OS'].'</td>';
echo '<td>'.$row['Host'].'</td>';
echo '</tr>' ;
} }
if($ok ==0){$er++;} if($diff->format("%R%a") == "-0"){$LastGood = "NEVER";}else{$LastGood = $row['LastKnownGood']." (".$diff->format("%R%a")."J)";}
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>".$row['LastBackup']." ".$row['TimeStamp']."</td>";
echo "<td>".$row['LastResult']."</td>";
echo "<td>".$LastGood."</td>";
echo "<td>".$row['LastSize']."</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
} }
?>
// Backup OK
$outdated = 0;
$answers = Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and owner not like '%VMH-WM%' and Exclusion ='' and LastResult = 'OK' order by name");
foreach ($answers as $row) {
$date1 = date_create($row['LastKnownGood']); $diff = date_diff($date1, date_create(date("Y-m-d")));
if(date('w') >= 2 && date('w') <= 6 ){
if ($diff->format("%R%a") >= 2){
echo "<tr class='table-warning'>";
}else{
echo "<tr class='table-success'>";
}
}else{
if((date('w') < 2 || date('w') == 7)){
if($diff->format("%R%a") <= 3){
echo "<tr class='table-success'>";
}else{
echo "<tr class='table-warning'>";
}
}
}
if($diff->format("%R%a") == "-0"){$LastGood = $row['LastKnownGood'];}else{$LastGood = $row['LastKnownGood']." (".$diff->format("%R%a")."J)";}
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>".$row['LastBackup']." ".$row['TimeStamp']."</td>";
echo "<td>".$row['LastResult']."</td>";
if (date('w') >= 2 && date('w') <= 6 && $diff->format("%R%a") < 1){
echo "<td>".$LastGood."</td>";
}else{
echo "<td class='table-warning'>".$LastGood."</td>";
$outdated++;
}
echo "<td>".$row['LastSize']."</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
}
// Backup OK
$excluded = 0;
$answers = Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and owner not like '%VMH-WM%' and Exclusion <> '' order by name");
foreach ($answers as $row) {
$excluded++;
echo "<tr class='table-secondary'>";
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>Tag NoBackup</td>";
echo "<td>Tag NoBackup</td>";
echo "<td>Tag NoBackup</td>";
echo "<td>Tag NoBackup</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
}
?>
</tbody> </tbody>
</table> </table>
<br> <br>
@@ -131,6 +165,9 @@
</div> </div>
</div> </div>
</div> </div>
<?php
$ERR = "VMs backups (<span class='text-danger'>".$er." issues</span> - <span class='text-warning'>".$outdated." outdated </span>- <span class='text-info'>".$excluded.' excluded</span>)';
?>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
@@ -158,11 +195,6 @@
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
document.getElementById("ERR").innerHTML = "<?php echo 'VMs backups ('.$er.' issues)'; ?>"; document.getElementById("ERR").innerHTML = "<?php echo $ERR ; ?>";
</script> </script>
</SCRIPT>

257
Storage/Dashboard.php Normal file
View File

@@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title -->
<title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
<!-- Chart -->
<script src="/js/chart.min.js"></script>
</head>
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/all.php" ; ?>
<div class="container-fluid">
<div class="row flex-nowrap">
<!-- Left NAVBAR -->
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar -->
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVC Storage Dashboard</span></h1>
<!-- Main content -->
<?php
//Gold => 5100
//Silver => 5030
$GB = 1024*1024*1024;
$TB = $GB * 1024;
//get full data
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php",''),true);
// Sum LUN Size by Bay
$lunsGold = 0 ; $lunsSilver = 0 ;
try{
foreach($json['Data']['VolumeCopies'] as $data){
if(strpos($data['mdisk_grp_name'],"5100") !== false){
$lunsGold += $data['capacity'] ;
}else{
$lunsSilver += $data['capacity'] ;
}
}
}catch(Exception $e){}
// Get Full Capacity
$goldCapacity = 0 ; $silverCapacity = 0 ; $GoldCompression = 0;$SilverCompression = 0;
foreach($json['Data']['Pools'] as $data){
if(strpos($data['name'],"5100") !== false){
$goldCapacity += $data['capacity'] ;
if($data['used_capacity'] > 0){
$GoldCompression += ($data['real_capacity'] / $data['used_capacity']);
}
}else{
$silverCapacity += $data['capacity'] ;
if($data['used_capacity'] > 0){
$SilverCompression += ($data['real_capacity'] / $data['used_capacity']);
}
}
}
// Datas
$goldCapacity = $goldCapacity / 2;
$silverCapacity = $silverCapacity / 2 ;
$GoldFree = $goldCapacity - $lunsGold ;
$SilverFree = $silverCapacity - $lunsSilver ;
$goldPercentUsed = round($lunsGold / $goldCapacity * 100 ,2) ;
$silverPercentUsed = round($lunsSilver / $silverCapacity * 100 ,2) ;
$GoldCompression = round($GoldCompression / 2,2);
$SilverCompression = round($GoldCompression / 2,2);
// Unnasigned Luns
$unnasigned = 0 ;
$cuc = "bg-success";
$lLUN = "";
foreach($json['Data']['Volumes'] as $volume){
if($volume['protocol'] != "scsi"){$unnasigned++;$cuc = "bg-warning";$lLUN .= $volume['name']."<br>";}
}
// Orphan Hosts
$orphanHosts = 0 ;
$chc = "bg-success";
$lHOST = "";
foreach($json['Data']['Hosts'] as $host){
if($host['protocol'] != "scsi"){$orphanHosts++;$chc = "bg-warning";$lHOST .= $host['name']."<br>";}
}
if($json['Data']['Hostclusters']){
foreach($json['Data']['Hostclusters'] as $host){
if($host['protocol'] != "scsi"){$orphanHosts++;$chc = "bg-warning";$lHOST .= $host['name']."<br>";}
}
}
?>
<br>
<!-- Carte GOLD -->
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Gold (V5100)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row">
<div class="col">
<b>Total Capacity : </b><?php echo round($goldCapacity / $TB,2); ?> TB
</div>
<div class="col">
<b>Used (raw) : </b><?php echo round($lunsGold / $TB,2); ?> TB (<?php echo $goldPercentUsed ;?>% )
</div>
<div class="col">
<b>Free (raw) : </b><?php echo round($GoldFree / $TB,2); ?> TB
</div>
</div>
<div class="row">
<div class="col"></div>
<div class="col">
<b>Compression : </b><?php echo number_format($GoldCompression, 2, ',', '') ; ?>:1
</div>
<div class="col">
<b>Free (estimated) : </b><?php echo round($GoldFree * $GoldCompression / $TB,2) ; ?> TB
</div>
</div>
<br>
<div class="progress border border-light" style="height: 40px;">
<?php
$pbc = "bg-success";
if($goldPercentUsed >= 75){$pbc = "bg-warning";}
if($goldPercentUsed >= 90){$pbc = "bg-danger";}
?>
<div class="progress-bar <?php echo $pbc; ?>" role="progressbar" style="width: <?php echo $goldPercentUsed ;?>%;" aria-valuenow="<?php echo $goldPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-black bg-gradient" role="progressbar" style="width: <?php echo 100 - $goldPercentUsed ;?>%;" aria-valuenow="<?php echo 100 - $goldPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
<br>
<!-- Carte Silver -->
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Silver (V5030)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row">
<div class="col">
<b>Total Capacity : </b><?php echo round($silverCapacity / $TB,2); ?> TB
</div>
<div class="col">
<b>Used (raw) : </b><?php echo round($lunsSilver / $TB,2); ?> TB (<?php echo $silverPercentUsed ;?>% )
</div>
<div class="col">
<b>Free (raw) : </b><?php echo round($SilverFree / $TB,2); ?> TB
</div>
</div>
<div class="row">
<div class="col"></div>
<div class="col">
<b>Compression : </b><?php echo number_format($SilverCompression, 2, ',', ''); ?>:1
</div>
<div class="col">
<b>Free (estimated) : </b><?php echo round($SilverFree * $SilverCompression / $TB,2) ; ?> TB
</div>
</div>
<br>
<div class="progress border border-light" style="height: 40px;">
<?php
$pbc = "bg-success";
if($silverPercentUsed >= 75){$pbc = "bg-warning";}
if($silverPercentUsed >= 90){$pbc = "bg-danger";}
?>
<div class="progress-bar <?php echo $pbc; ?>" role="progressbar" style="width: <?php echo $silverPercentUsed ;?>%;" aria-valuenow="<?php echo $silverPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-black bg-gradient" role="progressbar" style="width: <?php echo 100 - $silverPercentUsed ;?>%;" aria-valuenow="<?php echo 100 - $silverPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
<hr>
<!-- IO_grp -->
<div class="row flex-nowrap text-center">
<div class="col"><!-- GRP0 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 0</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp0']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp0']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- GRP1 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 1</h5>
</div>
<div class="card-body bg-dark text-left">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp1']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp1']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- GRP2 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 2</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp2']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp2']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- Orphan LUNS -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center <?php echo $cuc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip" data-placement="top" title="<?php echo $lLUN;?>"><b><?php echo $unnasigned; ?></b></button>
</div>
</div>
</div>
<div class="col"><!-- Orphan Hosts -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center <?php echo $chc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Hosts w/o LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip" data-placement="top" title="<?php echo $lHOST;?>"><b><?php echo $orphanHosts; ?></b></button>
</div>
</div>
</div>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>

210
Storage/Dashboard2.php Normal file
View File

@@ -0,0 +1,210 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title -->
<title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
<!-- Chart -->
<script src="/js/chart.min.js"></script>
</head>
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/all.php" ; ?>
<div class="container-fluid">
<div class="row flex-nowrap">
<!-- Left NAVBAR -->
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar -->
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVC Storage Dashboard</span></h1>
<!-- Main content -->
<?php
//Gold => 5100
//Silver => 5030
$GB = 1024*1024*1024;
$TB = $GB * 1024;
//get full data
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php",''),true);
// Sum LUN Size by Bay
$lunsGold = 0 ; $lunsSilver = 0 ;
foreach($json['Data']['VolumeCopies'] as $data){
if(strpos($data['mdisk_grp_name'],"5100") !== false){
$lunsGold += $data['capacity'] ;
}else{
$lunsSilver += $data['capacity'] ;
}
}
// Get Full Capacity
$goldCapacity = 0 ; $silverCapacity = 0 ; $GoldCompression = 0;$SilverCompression = 0;
foreach($json['Data']['Pools'] as $data){
if(strpos($data['name'],"5100") !== false){
$goldCapacity += $data['capacity'] ;
$GoldCompression += ($data['real_capacity'] / $data['used_capacity']);
}else{
$silverCapacity += $data['capacity'] ;
$SilverCompression += ($data['real_capacity'] / $data['used_capacity']);
}
}
// Datas
$goldCapacity = $goldCapacity / 2;
$silverCapacity = $silverCapacity / 2 ;
$GoldFree = $goldCapacity - $lunsGold ;
$SilverFree = $silverCapacity - $lunsSilver ;
$goldPercentUsed = round($lunsGold / $goldCapacity * 100 ,2) ;
$silverPercentUsed = round($lunsSilver / $silverCapacity * 100 ,2) ;
$GoldCompression = round($GoldCompression / 2,2);
$SilverCompression = round($GoldCompression / 2,2);
// Unnasigned Luns
$unnasigned = 0 ;
$cuc = "bg-success";
foreach($json['Data']['Volumes'] as $volume){
if($volume['protocol'] != "scsi"){$unnasigned++;$cuc = "bg-warning";}
}
?>
<br>
<!-- Carte GOLD -->
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Gold (V5100)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row">
<div class="col">
<b>Total Capacity : </b><?php echo round($goldCapacity / $TB,2); ?> TB
</div>
<div class="col">
<b>Used : </b><?php echo round($lunsGold / $TB,2); ?> TB (<?php echo $goldPercentUsed ;?>% )
</div>
<div class="col">
<b>Free : </b><?php echo round($GoldFree / $TB,2); ?> TB
</div>
<div class="col">
<b>Compression : </b><?php echo $GoldCompression ; ?>:1
</div>
</div>
<br>
<div class="progress border border-light" style="height: 40px;">
<?php
$pbc = "bg-success";
if($goldPercentUsed >= 75){$pbc = "bg-warning";}
if($goldPercentUsed >= 90){$pbc = "bg-danger";}
?>
<div class="progress-bar <?php echo $pbc; ?>" role="progressbar" style="width: <?php echo $goldPercentUsed ;?>%;" aria-valuenow="<?php echo $goldPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-black bg-gradient" role="progressbar" style="width: <?php echo 100 - $goldPercentUsed ;?>%;" aria-valuenow="<?php echo 100 - $goldPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
<br>
<!-- Carte Silver -->
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Silver (V5030)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row">
<div class="col">
<b>Total Capacity : </b><?php echo round($silverCapacity / $TB,2); ?> TB
</div>
<div class="col">
<b>Used : </b><?php echo round($lunsSilver / $TB,2); ?> TB (<?php echo $silverPercentUsed ;?>% )
</div>
<div class="col">
<b>Free : </b><?php echo round($SilverFree / $TB,2); ?> TB
</div>
<div class="col">
<b>Compression : </b><?php echo $SilverCompression ; ?>:1
</div>
</div>
<br>
<div class="progress border border-light" style="height: 40px;">
<?php
$pbc = "bg-success";
if($silverPercentUsed >= 75){$pbc = "bg-warning";}
if($silverPercentUsed >= 90){$pbc = "bg-danger";}
?>
<div class="progress-bar <?php echo $pbc; ?>" role="progressbar" style="width: <?php echo $silverPercentUsed ;?>%;" aria-valuenow="<?php echo $silverPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-black bg-gradient" role="progressbar" style="width: <?php echo 100 - $silverPercentUsed ;?>%;" aria-valuenow="<?php echo 100 - $silverPercentUsed ;?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
<hr>
<!-- IO_grp -->
<div class="row flex-nowrap text-center">
<div class="col"><!-- GRP0 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 0</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp0']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp0']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- GRP1 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 1</h5>
</div>
<div class="card-body bg-dark text-left">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp1']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp1']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- GRP2 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 2</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp2']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp2']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- Orphan LUNS -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center <?php echo $cuc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<b><?php echo $unnasigned; ?></b>
</div>
</div>
</div>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>

41
Storage/test.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
?>
<?php
//Gold => 5100
//Silver => 5030
$GB = 1024*1024*1024;
$TB = $GB * 1024;
//get full data
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php",''),true);
// Sum LUN Size by Bay
$lunsGold = 0 ; $lunsSilver = 0 ;
foreach($json['Data']['VolumeCopies'] as $data){
if(strpos($data['mdisk_grp_name'],"5100") !== false){
$lunsGold += $data['capacity'] ;
}else{
$lunsSilver += $data['capacity'] ;
}
}
// Get Full Capacity
$goldCapacity = 0 ; $silverCapacity = 0 ;
foreach($json['Data']['Pools'] as $data){
if(strpos($data['name'],"5100") !== false){
$goldCapacity += $data['capacity'] ;
}else{
$silverCapacity += $data['capacity'] ;
}
}
// Datas
$goldCapacity = $goldCapacity / 2;
$silverCapacity = $silverCapacity / 2 ;
$GoldFree = $goldCapacity - $lunsGold ;
$SilverFree = $silverCapacity - $lunsSilver ;
$goldPercentUsed = round($lunsGold / $goldCapacity * 100 ,2) ;
$silverPercentUsed = round($lunsSilver / $silverCapacity * 100 ,2) ;
?>

View File

@@ -55,7 +55,16 @@
<li class="w-100"> <li class="w-100">
<a href="/Hyper-V/clusters.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Hyper-V Clusters</span></a> <a href="/Hyper-V/clusters.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Hyper-V Clusters</span></a>
<a href="/Hyper-V/VMs-Backups.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- VMs Backups</span></a> <a href="/Hyper-V/VMs-Backups.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- VMs Backups</span></a>
<a href="/Hyper-V/migration.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Migration FollowUp</span></a>
</li>
</ul>
</li>
<li>
<a href="#Storage" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-server text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Storage</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="Storage" data-bs-parent="#menu">
<li class="w-100">
<a href="/Storage/Dashboard.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Dashboard IBM SAN</span></a>
</li> </li>
</ul> </ul>
</li> </li>