Remove unused PHP files related to Hyper-V and Storage dashboards
- Deleted `cluster-detail2.php`, `constants.inc copy.php`, `D.php`, and `Dashboard2.php`. These files were no longer in use and contributed to unnecessary clutter in the codebase. - Cleaned up references to removed files.
This commit is contained in:
@@ -24,184 +24,199 @@
|
||||
<script src="/js/chart.min.js"></script>
|
||||
<script src="/js/apexcharts.min.js"></script>
|
||||
<!-- Gauge -->
|
||||
<link rel="stylesheet" href="/css/gauge.css">
|
||||
<link rel="stylesheet" href="/css/Gauge.css">
|
||||
<script src="/js/jquery.AshAlom.gaugeMeter-2.0.0.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-light text-dark">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Database connexion -->
|
||||
<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%;"><?php $_GET['cluster']." Details" ; ?></span></h1>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Database connexion -->
|
||||
<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%;"><?php echo $_GET['cluster'] . " Details"; ?></span></h1>
|
||||
|
||||
<!-- Main content -->
|
||||
<!-- Main content -->
|
||||
<?php
|
||||
$clusters = Invoke_Infra("select * from cmdb_HyperV_Hosts where cluster ='" . $_GET['cluster'] . "' order by node");
|
||||
$vmmem = (Invoke_Infra("select sum(cast(vm_memory as int)) as vmem from cmdb_HyperV_Hosts where cluster ='" . $_GET['cluster'] . "'"))[0]['vmem'];
|
||||
$clumem = (invoke_infra("select min(node_ram) as nmem from cmdb_HyperV_Hosts where cluster ='" . $_GET['cluster'] . "'"))[0]['nmem'];
|
||||
$nb = (invoke_infra("select count(node) as nb from cmdb_HyperV_Hosts where cluster ='" . $_GET['cluster'] . "'"))[0]['nb'];
|
||||
$clmem = $clumem - 32;
|
||||
if ($nb == 4) {
|
||||
$clmem = $clmem * 2;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="container-fluid" style="zoom:100%">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold"
|
||||
style="width:100%;"><?php echo $_GET['cluster']; ?></span></h2>
|
||||
<?php
|
||||
$clusters = Invoke_Infra("select * from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."' order by node");
|
||||
$vmmem = (Invoke_Infra("select sum(cast(vm_memory as int)) as vmem from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."'"))[0]['vmem'];
|
||||
$clumem = (invoke_infra("select min(node_ram) as nmem from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."'"))[0]['nmem'];
|
||||
$nb = (invoke_infra("select count(node) as nb from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."'"))[0]['nb'];
|
||||
$clmem = $clumem-32; if($nb == 4){$clmem = $clmem*2;}
|
||||
|
||||
?>
|
||||
<div class="container-fluid" style="zoom:100%">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo $_GET['cluster']; ?></span></h2>
|
||||
<?php
|
||||
echo "<b>Worst Failover scenario available memory : </b>".($clmem - $vmmem). " / " .$clmem. " GB";
|
||||
$pcent = round(($clmem - $vmmem)/$clmem*100);
|
||||
$pcent_restant = 100 - $pcent;
|
||||
if($pcent <= 5){
|
||||
$color = "bg-danger"; $border = "red";
|
||||
}else{
|
||||
if($pcent <= 10){
|
||||
$color = "bg-warning"; $border = "yellow";
|
||||
}else{
|
||||
$color = "bg-success"; $border = "green";
|
||||
}
|
||||
echo "<b>Worst Failover scenario available memory : </b>" . ($clmem - $vmmem) . " / " . $clmem . " GB";
|
||||
$pcent = round(($clmem - $vmmem) / $clmem * 100);
|
||||
$pcent_restant = 100 - $pcent;
|
||||
if ($pcent <= 5) {
|
||||
$color = "bg-danger";
|
||||
$border = "red";
|
||||
} else {
|
||||
if ($pcent <= 10) {
|
||||
$color = "bg-warning";
|
||||
$border = "yellow";
|
||||
} else {
|
||||
$color = "bg-success";
|
||||
$border = "green";
|
||||
}
|
||||
echo "
|
||||
}
|
||||
echo "
|
||||
<div class='progress' style='border: 2px solid $border; height: 25px;'>
|
||||
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width: $pcent_restant%;' aria-valuenow='$pcent_restant' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
<div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
</div>";
|
||||
echo "<br>";
|
||||
?>
|
||||
<div class="row">
|
||||
<?php
|
||||
echo "<br>";
|
||||
?>
|
||||
<div class="row">
|
||||
<?php
|
||||
foreach ($clusters as $cluster) {
|
||||
echo "<div class='col-6'>";
|
||||
$nbvm = Invoke_Infra("select count(*) as nbvm, sum(memory) as vmmem from cmdb_vms where owner ='".$cluster['node']."' and decomtime is null");
|
||||
echo '<h3><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">'.$cluster['node']." - ".$nbvm[0]['nbvm']." VMs <small><small> <i class='bi bi-clock'></i> ".$cluster['ts']."</small></small></span></h3><br>";
|
||||
#Memory
|
||||
echo "<div class='row'>";
|
||||
echo "<div class='col'>";
|
||||
echo "<b>Free Memory : </b>".($cluster['node_ram'] - 32 - $nbvm[0]['vmmem']). " / " .($cluster['node_ram'] - 32). " GB";
|
||||
$pcent = round(($cluster['node_ram'] - 32 - $nbvm[0]['vmmem'])/($cluster['node_ram'] - 32)*100);
|
||||
$pcent_restant = 100 - $pcent;
|
||||
if($pcent <= 5){
|
||||
$color = "bg-danger";
|
||||
}else{
|
||||
if($pcent <= 10){
|
||||
$color = "bg-warning";
|
||||
}else{
|
||||
$color = "bg-success";
|
||||
}
|
||||
}
|
||||
$progress_bar_height = '25px';
|
||||
$marker_overlap = 5;
|
||||
$marker_height = (int)$progress_bar_height + (2 * $marker_overlap);
|
||||
$marker_top = -$marker_overlap;
|
||||
echo "</div>";
|
||||
echo "
|
||||
$nbvm = Invoke_Infra("select count(*) as nbvm, sum(memory) as vmmem from cmdb_vms where owner ='" . $cluster['node'] . "' and decomtime is null");
|
||||
echo '<h3><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">' . $cluster['node'] . " - " . $nbvm[0]['nbvm'] . " VMs <small><small> <i class='bi bi-clock'></i> " . $cluster['ts'] . "</small></small></span></h3><br>";
|
||||
#Memory
|
||||
echo "<div class='row'>";
|
||||
echo "<div class='col'>";
|
||||
echo "<b>Free Memory : </b>" . ($cluster['node_ram'] - 32 - $nbvm[0]['vmmem']) . " / " . ($cluster['node_ram'] - 32) . " GB";
|
||||
$pcent = round(($cluster['node_ram'] - 32 - $nbvm[0]['vmmem']) / ($cluster['node_ram'] - 32) * 100);
|
||||
$pcent_restant = 100 - $pcent;
|
||||
if ($pcent <= 5) {
|
||||
$color = "bg-danger";
|
||||
} else {
|
||||
if ($pcent <= 10) {
|
||||
$color = "bg-warning";
|
||||
} else {
|
||||
$color = "bg-success";
|
||||
}
|
||||
}
|
||||
$progress_bar_height = '25px';
|
||||
$marker_overlap = 5;
|
||||
$marker_height = (int)$progress_bar_height + (2 * $marker_overlap);
|
||||
$marker_top = -$marker_overlap;
|
||||
echo "</div>";
|
||||
echo "
|
||||
<div style='position: relative; display: inline-block;'>
|
||||
<div class='progress' style='border: 1px solid grey; height: ".$progress_bar_height."; margin-bottom: ".(2 * $marker_overlap)."px;'>
|
||||
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width:". $pcent_restant ."%;' aria-valuenow='".$pcent_restant."' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
<div class='progress-bar ".$color."' role='progressbar' style='width: ".$pcent."%;' aria-valuenow='".$pcent."' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
<div class='progress' style='border: 1px solid grey; height: " . $progress_bar_height . "; margin-bottom: " . (2 * $marker_overlap) . "px;'>
|
||||
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width:" . $pcent_restant . "%;' aria-valuenow='" . $pcent_restant . "' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
<div class='progress-bar " . $color . "' role='progressbar' style='width: " . $pcent . "%;' aria-valuenow='" . $pcent . "' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
</div>
|
||||
|
||||
<div style='
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
top: ".$marker_top."px;
|
||||
height: ".$marker_height."px;
|
||||
top: " . $marker_top . "px;
|
||||
height: " . $marker_height . "px;
|
||||
width: 2px;
|
||||
background-color: orange;
|
||||
z-index: 1;
|
||||
'></div>
|
||||
|
||||
</div>";
|
||||
echo "</div>" ;
|
||||
echo "<br>";
|
||||
|
||||
#Storage
|
||||
echo "<div class='row'>";
|
||||
foreach(explode("|",$cluster['csvs']) as $csv){
|
||||
if(strpos($csv,";") != false){
|
||||
echo "<div class='col'>";
|
||||
echo "<b>" . explode(";",$csv)[0];
|
||||
$total = explode(";",$csv)[1]; $used = explode(";",$csv)[2]; $free = $total-$used ;
|
||||
echo " Free : </b>".$free."/" .$total. " GB";
|
||||
echo "</div>";
|
||||
echo "<div class='col'>";
|
||||
$pcent = round($free/$total*100);
|
||||
$pcent_restant = 100 - $pcent;
|
||||
if($pcent <= 10){
|
||||
$color = "bg-danger";
|
||||
}else{
|
||||
if($pcent <= 20){
|
||||
$color = "bg-warning";
|
||||
}else{
|
||||
$color = "bg-success";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
echo "</div>";
|
||||
echo "<br>";
|
||||
|
||||
#Storage
|
||||
echo "<div class='row'>";
|
||||
foreach (explode("|", $cluster['csvs']) as $csv) {
|
||||
if (strpos($csv, ";")) {
|
||||
echo "<div class='col'>";
|
||||
echo "<b>" . explode(";", $csv)[0];
|
||||
$total = explode(";", $csv)[1];
|
||||
$used = explode(";", $csv)[2];
|
||||
$free = $total - $used;
|
||||
echo " Free : </b>" . $free . "/" . $total . " GB";
|
||||
echo "</div>";
|
||||
echo "<div class='col'>";
|
||||
$pcent = round($free / $total * 100);
|
||||
$pcent_restant = 100 - $pcent;
|
||||
if ($pcent <= 10) {
|
||||
$color = "bg-danger";
|
||||
} else {
|
||||
if ($pcent <= 20) {
|
||||
$color = "bg-warning";
|
||||
} else {
|
||||
$color = "bg-success";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<div class='progress' style='border: 1px solid grey; height: 25px;'>
|
||||
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width: $pcent_restant%;' aria-valuenow='$pcent_restant' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
<div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div>
|
||||
</div>";
|
||||
echo "</div>";
|
||||
}else{echo "<div class='col'></div><br>";}
|
||||
}
|
||||
echo "</div>";
|
||||
echo "<hr>";
|
||||
|
||||
#VMs
|
||||
$vms = Invoke_Infra("select * from cmdb_vms where owner ='".$cluster['node']."' and decomtime is null order by name");
|
||||
foreach($vms as $vm){
|
||||
echo "<div class='row'>";
|
||||
echo "<div class='col'>";
|
||||
$state = '<i class="bi bi-question-square-fill text-primary"></i> ';
|
||||
if($vm['State'] == "Running"){$state = '<i class="bi bi-play-btn-fill text-success"></i> ';}
|
||||
if($vm['State'] == "Off" || $vm['State'] == "Stopping"){$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';}
|
||||
if($vm['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
|
||||
if(strpos($vm['Name'],'WS') === 0){
|
||||
echo $state." <b>".substr($vm['Name'],0,10)."</b>";
|
||||
}else{
|
||||
echo $state." <b>".$vm['Name']."</b>";
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='col'>";
|
||||
echo '<span class="badge rounded-pill bg-secondary text-light">'.$vm['Memory'].'GB / '.$vm['CPU'].' CPU</span> ';
|
||||
if($vm['WWPNs'] != ""){
|
||||
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
|
||||
}
|
||||
#echo "</div>";
|
||||
|
||||
#echo "<div class='col'>";
|
||||
if($vm['IsClustered'] != "True"){
|
||||
echo '<span class="badge rounded-pill bg-danger text-dark"><small>Unclustered</small></span> ';
|
||||
}else{
|
||||
if($vm['Owner'] != $vm['PreferredOwner']){
|
||||
echo '<span class="badge rounded-pill bg-warning text-dark"><small>Wrong Owner</small></span> ';
|
||||
}
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='col'>";
|
||||
echo "</div>";
|
||||
|
||||
echo "</div>";
|
||||
} else {
|
||||
echo "<div class='col'></div><br>";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
echo "</div>";
|
||||
echo "<hr>";
|
||||
|
||||
#VMs
|
||||
$vms = Invoke_Infra("select * from cmdb_vms where owner ='" . $cluster['node'] . "' and decomtime is null order by name");
|
||||
foreach ($vms as $vm) {
|
||||
echo "<div class='row'>";
|
||||
echo "<div class='col'>";
|
||||
$state = '<i class="bi bi-question-square-fill text-primary"></i> ';
|
||||
if ($vm['State'] == "Running") {
|
||||
$state = '<i class="bi bi-play-btn-fill text-success"></i> ';
|
||||
}
|
||||
if ($vm['State'] == "Off" || $vm['State'] == "Stopping") {
|
||||
$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';
|
||||
}
|
||||
if ($vm['State'] == "Paused") {
|
||||
$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';
|
||||
}
|
||||
if (str_starts_with($vm['Name'], 'WS')) {
|
||||
echo $state . " <b>" . substr($vm['Name'], 0, 10) . "</b>";
|
||||
} else {
|
||||
echo $state . " <b>" . $vm['Name'] . "</b>";
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='col'>";
|
||||
echo '<span class="badge rounded-pill bg-secondary text-light">' . $vm['Memory'] . 'GB / ' . $vm['CPU'] . ' CPU</span> ';
|
||||
if ($vm['WWPNs'] != "") {
|
||||
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
|
||||
}
|
||||
if ($vm['IsClustered'] != "True") {
|
||||
echo '<span class="badge rounded-pill bg-danger text-dark"><small>Unclustered</small></span> ';
|
||||
} else {
|
||||
if ($vm['Owner'] != $vm['PreferredOwner']) {
|
||||
echo '<span class="badge rounded-pill bg-warning text-dark"><small>Wrong Owner</small></span> ';
|
||||
}
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='col'>";
|
||||
echo "</div>";
|
||||
|
||||
echo "</div>";
|
||||
}
|
||||
echo "<br>";
|
||||
echo "</div>";
|
||||
}
|
||||
echo "</div>";
|
||||
?>
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
?>
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/switch.js"></script>
|
||||
</div>
|
||||
<script src="/js/switch.js"></script>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user