update hyper-v part

This commit is contained in:
e025532
2025-03-20 15:07:45 +01:00
parent a23577c290
commit c15a86d6a8
12 changed files with 1137 additions and 58 deletions

165
Hyper-V/Legacy-VMList.php Normal file
View File

@@ -0,0 +1,165 @@
<!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 -->
<?php $answers = Invoke_Infra("select * from cmdb_vms where cluster not like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?>
<!-- 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%;" >Legacy Hyper-V VM List - <?php echo count($answers); ?> VMs</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='owner' data-sortable='true'>Owner</th>
<th data-field='infos' data-sortable='true'>Infos</th>
<th data-field='PreferedOwner' data-sortable='true'>Prefered Owner</th>
<th data-field='gen-ver' data-sortable='true'>Gen & Version</th>
<th data-field='LastInventory' data-sortable='true'>Last Seen</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $row) {
echo "<tr>";
# Name
$state = '<i class="bi bi-question-square-fill text-primary"></i> ';
if($row['State'] == "Running"){$state = '<i class="bi bi-play-btn-fill text-success"></i> ';}
if($row['State'] == "Off" || $row['State'] == "Stopping"){$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';}
if($row['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
echo "<td>".$state." <b>".$row['Name']."</td>";
# Owner
echo "<td>".$row['Owner']."</td>";
# Infos
echo '<td><span class="badge rounded-pill bg-secondary text-light">'.$row['Memory'].'GB / '.$row['CPU'].' CPU</span> ';
echo '<span class="badge rounded-pill bg-secondary text-light">VHDx(s) : '.$row['TotalDiskSize'].' GB</span> ';
if($row['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
}
echo "</td>";
# Prefered Owner
if($row['Owner'] == $row['PreferredOwner']){
echo '<td><span class="badge rounded-pill bg-success text-light">'.$row['Owner'].'</span></td> ';
}else{
if($row['IsClustered'] == 'True'){
echo '<td><span class="badge rounded-pill bg-warning text-dark">'.$row['PreferredOwner'].'</span></td> ';
}else{
echo '<td><span class="badge rounded-pill bg-danger text-dark">NOT CLUSTERED</span></td> ';
}
}
# Gen & Ver
echo "<td>";
if($row['Generation'] == "2"){
echo '<span class="badge rounded-pill bg-success text-light">Gen '.$row['Generation'].'</span> ';
}else{
echo '<span class="badge rounded-pill bg-warning text-dark">Gen '.$row['Generation'].'</span> ';
}
if($row['Version'] == "10.0"){
echo '<span class="badge rounded-pill bg-success text-light">Ver '.$row['Version'].'</span> ';
}else{
echo '<span class="badge rounded-pill bg-warning text-dark">Ver '.$row['Version'].'</span> ';
}
echo "</td>";
# TS
echo "<td>".$row['LastInventory']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</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

@@ -140,9 +140,6 @@
</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>

178
Hyper-V/SYN-VMList.php Normal file
View File

@@ -0,0 +1,178 @@
<!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 -->
<?php $answers = Invoke_Infra("select * from cmdb_vms where cluster like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?>
<!-- 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%;" >Synergy VM List - <?php echo count($answers); ?> VMs</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>
<div id="result" class="text-center"></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='owner' data-sortable='true'>Owner</th>
<th data-field='infos' data-sortable='true'>Infos</th>
<th data-field='PreferedOwner' data-sortable='true'>Prefered Owner</th>
<th data-field='gen-ver' data-sortable='true'>Gen & Version</th>
<th data-field='LastInventory' data-sortable='true'>Last Seen</th>
</thead>
<tbody> <!-- Body -->
<?php
$wrongOwner = $unclustered = $v10 = 0 ; $msg ="" ; $CpuComp = 0;
foreach ($answers as $row) {
echo "<tr>";
# Name
$state = '<i class="bi bi-question-square-fill text-primary"></i> ';
if($row['State'] == "Running"){$state = '<i class="bi bi-play-btn-fill text-success"></i> ';}
if($row['State'] == "Off" || $row['State'] == "Stopping"){$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';}
if($row['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
echo "<td>".$state." <b>".$row['Name']."</td>";
# Owner
echo "<td>".$row['Owner']."</td>";
# Infos
echo '<td><span class="badge rounded-pill bg-secondary text-light">'.$row['Memory'].'GB / '.$row['CPU'].' CPU</span> ';
echo '<span class="badge rounded-pill bg-secondary text-light">VHDx(s) : '.$row['TotalDiskSize'].' GB</span> ';
if($row['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
}
if($row['CPUcomp'] == "True"){
echo '<span class="badge rounded-pill bg-warning text-dark">CPU Comp.</span> '; $CpuComp++;
}
echo "</td>";
# Prefered Owner
if($row['Owner'] == $row['PreferredOwner']){
echo '<td><span class="badge rounded-pill bg-success text-light">'.$row['Owner'].'</span></td> ';
}else{
if($row['IsClustered'] == 'True'){
echo '<td><span class="badge rounded-pill bg-warning text-dark">'.$row['Owner'].'</span></td> ';
$wrongOwner++;
}else{
echo '<td><span class="badge rounded-pill bg-danger text-dark">NOT CLUSTERED</span></td> ';
$unclustered++;
}
}
# Gen & Ver
echo "<td>";
if($row['Generation'] == "2"){
echo '<span class="badge rounded-pill bg-success text-light">Gen '.$row['Generation'].'</span> ';
}else{
echo '<span class="badge rounded-pill bg-warning text-dark">Gen '.$row['Generation'].'</span> ';
}
if($row['Version'] == "10.0"){
echo '<span class="badge rounded-pill bg-success text-light">Ver '.$row['Version'].'</span> ';
}else{
echo '<span class="badge rounded-pill bg-warning text-dark">Ver '.$row['Version'].'</span> ';
$v10++;
}
echo "</td>";
# TS
echo "<td>".$row['LastInventory']."</td>";
echo "</tr>";
}
if($wrongOwner > 0){$msg = "<span class='badge bg-warning text-dark'>$wrongOwner VM(s) on Wrong Owner</span>";}
if($unclustered > 0){$msg .= "&nbsp;<span class='badge bg-danger'>$unclustered VM(s) Unclustered</span>";}
if($v10 > 0){$msg .= "&nbsp;<span class='badge bg-warning text-dark'>$v10 VM(s) < Ver 10.0</span>";}
if($CpuComp > 0){$msg .= "&nbsp;<span class='badge bg-warning text-dark'>$CpuComp VM(s) With 'CPU Compatibility' checked</span>";}
?>
</tbody>
</table>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</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("result").innerHTML = "<?php echo "<h4>".$msg."</h4>" ; ?>";
</script>

171
Hyper-V/SYN-VMList2.php Normal file
View File

@@ -0,0 +1,171 @@
<!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 -->
<?php $answers = Invoke_Infra("select * from cmdb_vms where cluster like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?>
<!-- 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%;" >Synergy VM List - <?php echo count($answers); ?> VMs</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>
<div id="result" class="text-center"></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='owner' data-sortable='true'>Owner</th>
<th data-field='infos' data-sortable='true'>Infos</th>
<th data-field='PreferedOwner' data-sortable='true'>Prefered Owner</th>
<th data-field='gen-ver' data-sortable='true'>Gen & Version</th>
<th data-field='LastInventory' data-sortable='true'>Last Seen</th>
</thead>
<tbody> <!-- Body -->
<?php
$wrongOwner = $unclutered = 0 ; $msg ="" ;
foreach ($answers as $row) {
echo "<tr>";
# Name
$state = '<i class="bi bi-question-square-fill text-primary"></i> ';
if($row['State'] == "Running"){$state = '<i class="bi bi-play-btn-fill text-success"></i> ';}
if($row['State'] == "Off" || $row['State'] == "Stopping"){$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';}
if($row['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
echo "<td>".$state." <b>".$row['Name']."</td>";
# Owner
echo "<td>".$row['Owner']."</td>";
# Infos
echo '<td><span class="badge rounded-pill bg-secondary text-light">'.$row['Memory'].'GB / '.$row['CPU'].' CPU</span> ';
echo '<span class="badge rounded-pill bg-secondary text-light">VHDx(s) : '.$row['TotalDiskSize'].' GB</span> ';
if($row['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
}
echo "</td>";
# Prefered Owner
if($row['Owner'] == $row['PreferredOwner']){
echo '<td><span class="badge rounded-pill bg-success text-light">'.$row['Owner'].'</span></td> ';
}else{
if($row['IsClustered'] == 'True'){
echo '<td><span class="badge rounded-pill bg-warning text-dark">'.$row['Owner'].'</span></td> ';
$wrongOwner++;
}else{
echo '<td><span class="badge rounded-pill bg-danger text-dark">NOT CLUSTERED</span></td> ';
$unclustered++;
}
}
# Gen & Ver
echo "<td>";
if($row['Generation'] == "2"){
echo '<span class="badge rounded-pill bg-success text-light">Gen '.$row['Generation'].'</span> ';
}else{
echo '<span class="badge rounded-pill bg-warning text-dark">Gen '.$row['Generation'].'</span> ';
}
if($row['Version'] == "10.0"){
echo '<span class="badge rounded-pill bg-success text-light">Ver '.$row['Version'].'</span> ';
}else{
echo '<span class="badge rounded-pill bg-warning text-dark">Ver '.$row['Version'].'</span> ';
}
echo "</td>";
# TS
echo "<td>".$row['LastInventory']."</td>";
echo "</tr>";
if($wrongOwner > 0){$msg = "<span class='badge bg-warning'>$wrongOwner VM(s) on Wrong Owner<span>";}
if($unclustered > 0){$msg .= "&nbsp;<span class='badge bg-warning'>$unclustered VM(s) Unclustered<span>";}
}
?>
</tbody>
</table>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</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("result").innerHTML = "<?php echo $msg ; ?>";
</script>

View File

@@ -83,7 +83,7 @@
<?php
// NO Backup or Backup with Errors
$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");
$answers = Invoke_infra("SELECT * FROM VMs_Backup where ( Owner like 'DUN-VMH%' or Owner like 'MDK-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) {
$er++;
$date1 = date_create($row['LastKnownGood']); $diff = date_diff($date1, date_create(date("Y-m-d")));
@@ -106,7 +106,8 @@
// 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");
$answers = Invoke_infra("SELECT * FROM VMs_Backup where ( Owner like 'DUN-VMH%' or Owner like 'MDK-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");
$total = count($answers);
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 ){
@@ -146,7 +147,7 @@
// 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");
$answers = Invoke_infra("SELECT * FROM VMs_Backup where ( Owner like 'DUN-VMH%' or Owner like 'MDK-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'>";
@@ -170,7 +171,8 @@
</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>)';
$success = $total - $er - $outdated -$excluded ;
$ERR = "VMs backups (<span class='text-light'>".$total." Success</span> - <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>

View File

@@ -78,7 +78,7 @@
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</span></h3><br>";
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'>";
@@ -156,7 +156,7 @@
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">iSCSI</span> ';
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
}
#echo "</div>";

View File

@@ -57,19 +57,22 @@
echo "</div><div class='row'>";
}
$data = Invoke_Infra("select * from cmdb_HyperV_Hosts where cluster = '" . $cluster['cluster'] . "'");
$clumem = (invoke_infra("select min(node_ram) as nmem from cmdb_HyperV_Hosts where cluster ='".$cluster['cluster']."'"))[0]['nmem'];
$nb = (invoke_infra("select count(node) as nb from cmdb_HyperV_Hosts where cluster ='".$cluster['cluster']."'"))[0]['nb'];
$clmem = $clumem-32; if($nb == 4){$clmem = $clmem*2;}
$nodes = count($data);
$vms = 0;
$vm_mem = 0;
$disk = 0;
$io = 0;
$capacity = 0;
$capacity = 0; $free = 0;
foreach ($data as $d) {
$vms += $d['vm_count'];
$vm_mem += $d['vm_memory'];
$node_mem = 0 + (int) $d['node_ram'];
foreach (explode("|", $d['csvs']) as $csv) {
if (instr($csv, ';')) {
$free = explode(";", $csv)[1] - explode(";", $csv)[2];
$free += explode(";", $csv)[1] - explode(";", $csv)[2];
$disk = max($disk, $free);
$capacity += (int) explode(";", $csv)[1];
}
@@ -77,7 +80,8 @@
$io += $d['io_disk'];
}
$node_mem = $node_mem * count($data) / 2;
$io = number_format($io / count($data), 2);
$io= round($io / count($data) * 1024);
if($io == 0){$io = "?";}
$vmleft = floor(($node_mem - 24 - $vm_mem) / 16);
$storageleft = floor($disk / 110);
$vmleft = min($vmleft, $storageleft);
@@ -100,55 +104,110 @@
<center><?php echo $cluster['cluster']; ?></center>
</h4>
<h6>
<center><b><?php echo $nodes; ?></b> Nodes / <b><?php echo $vms; ?></b> VMs <?php echo $vleft; ?>
</center>
<center><b><?php echo $nodes; ?></b> Nodes / <b><?php echo $vms; ?></b> VMs <?php echo $vleft; ?></center>
</h6>
<?php
if((int)$nodes == 2 && $vms > 0){
$Repart = Invoke_Infra("select Owner, count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and decomtime is null group by Owner order by Owner");
$vmCountNode1 = $vmCountNode2 = 0;
$node1_name = $node2_name = "";
if(count($Repart) == 1 ){
$node1_name = $Repart[0]['Owner']; $vmCountNode1 = $Repart[0]['nbvm'];
}else{
$node1_name = 'DUN'; $vmCountNode1 = $Repart[0]['nbvm'];
$node2_name = 'MDK'; $vmCountNode2 = $Repart[1]['nbvm'];
}
$totalVMs = $vmCountNode1 + $vmCountNode2;
$percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0;
$percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0;
echo "<div class='progress' style='border: 2px solid grey; height: 20px;'>
<div class='progress-bar text-white' role='progressbar' style='width:$percentageNode1%' aria-valuenow='$percentageNode1' aria-valuemin='0' aria-valuemax='100'>
<b>$node1_name : $vmCountNode1 VMs</b>
</div>
<div class='progress-bar bg-info text-dark' role='progressbar' style='width:$percentageNode2%' aria-valuenow='$percentageNode2' aria-valuemin='0' aria-valuemax='100'>
<b>$node2_name : $vmCountNode2 VMs</b>
</div>
</div>";
}elseif((int)$nodes == 4){
$RepartD = Invoke_Infra("select count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and Owner like 'DUN%' and decomtime is null");
$RepartM = Invoke_Infra("select count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and Owner like 'MDK%' and decomtime is null");
$vmCountNode1 = $vmCountNode2 = 0;
$node1_name = 'DUN'; $vmCountNode1 = $RepartD[0]['nbvm'];
$node2_name = 'MDK'; $vmCountNode2 = $RepartM[0]['nbvm'];
$totalVMs = $vmCountNode1 + $vmCountNode2;
$percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0;
$percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0;
echo "<div class='progress' style='border: 2px solid grey; height: 20px;'>
<div class='progress-bar text-white' role='progressbar' style='width:$percentageNode1%' aria-valuenow='$percentageNode1' aria-valuemin='0' aria-valuemax='100'>
<b>$node1_name : $vmCountNode1 VMs</b>
</div>
<div class='progress-bar bg-info text-dark' role='progressbar' style='width:$percentageNode2%' aria-valuenow='$percentageNode2' aria-valuemin='0' aria-valuemax='100'>
<b>$node2_name : $vmCountNode2 VMs</b>
</div>
</div>";
}else{
echo "<div class='progress' style='border: 2px solid grey; height: 20px; background-Color: transparent;'>
<div class='progress-bar' style='width: 0%; background-color: transparent;'></div>
</div>";
}
?>
</div>
<div class='card-body text-white bg-dark'>
<div class='row'>
<?php
//Memory
echo "<div class='row'>";
echo "<div class='col-7'>";
echo "<b>Free Mem : </b>".($clmem - $vm_mem). " / " .$clmem. " GB";
echo "</div><div class='col-5'>";
$pcent = round(($clmem - $vm_mem)/$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 "
<div class='progress flex-grow-1' style='border: 2px solid $border; height: 20px;'>
<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></div>";
//DISK
echo "<div class='row'>";
echo "<div class='col-7'>";
$unit="GB";
if($capacity > 10000){
$capacity = round($capacity / 1024,1); $unit="TB";
$free = round($free / 1024,1);
}
$used = $capacity - $free;
echo "<b>Free CSV : </b>".$free. " / " .$capacity. " $unit";
echo "</div><div class='col-5'>";
$pcent = round(($free)/$capacity*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 "
<div class='progress flex-grow-1' style='border: 2px solid $border; height: 20px;'>
<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></div>";
echo "<div class='row'><div class='col-7'><b>CSV I/O</b> R/W (24h) :</div><div class='col-5'><b> $io KB/s</b></div></div>";
<div class='col'><!-- STORAGE -->
<?php if($storageleft>2){$color='green';}elseif($storageleft==2){$color='orange';}else{$color='red';}?>
<h5><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Max Storage</span></h5>
<center>
<div class='GaugeMeter'
data-total='<?php echo (int) $capacity; ?>'
data-used='<?php echo (int) ($capacity - $free); ?>'
data-text='<?php echo $disk; ?>'
data-size=100 data-width=5 data-back=RGBa(200,200,200,0.05)
data-color='<?php echo $color; ?>' data-style='full' data-animationstep=5
>
</center>
</div>
<div class='col'><!-- Memory -->
<?php if(floor(($node_mem-24-$vm_mem)/16)>2){$color='green';}elseif(floor(($node_mem-24-$vm_mem)/16)==2){$color='orange';}else{$color='red';}?>
<h5><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Max Memory</span></h5>
<center>
<div class='GaugeMeter'
data-total='<?php echo (int) ($node_mem - 24); ?>'
data-used='<?php echo (int) ($vm_mem); ?>'
data-text='<?php echo ($node_mem - 24 - $vm_mem); ?>'
data-size=100 data-width=5 data-back=RGBa(200,200,200,0.05)
data-color='<?php echo $color; ?>' data-style='full' data-animationstep=5
>
</center>
</div>
<div class='col'><!-- I/O Disk -->
<?php if($io<15){$color='green';}elseif($io<20){$color='orange';}else{$color='red';}?>
<h5><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">I/O Disk</span></h5>
<center>
<div class='GaugeMeter'
data-total=25
data-used='<?php echo min((int) $io, 25); ?>'
data-text='<?php echo $io; ?>'
data-size=100 data-width=5 data-back=RGBa(200,200,200,0.05)
data-color='<?php echo $color; ?>' data-style='full' data-animationstep=5
>
</center>
</div>
</div>
?>
</div>
</div>
</a>

233
Hyper-V/clusters2.php Normal file
View File

@@ -0,0 +1,233 @@
<!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>
<script src="/js/apexcharts.min.js"></script>
<!-- Gauge -->
<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%;">Hyper-V Clusters</span></h1>
<!-- Main content -->
<?php
$clusters = Invoke_Infra("select distinct cluster from cmdb_HyperV_Hosts where cluster <> '' and cluster not like '%-WM%' and cluster not like '%-C1MAS%' and cluster not like '%-vrs%' and (cluster like 'DUN%' or cluster like 'DMV%') order by cluster");
?>
<div class="container-fluid" style="zoom:90%">
<div class="row">
<?php
$count = 0;
$totalleft = 0;
foreach ($clusters as $cluster) {
if ($count / 4 == (int) ($count / 4)) {
echo "</div><div class='row'>";
}
$data = Invoke_Infra("select * from cmdb_HyperV_Hosts where cluster = '" . $cluster['cluster'] . "'");
$clumem = (invoke_infra("select min(node_ram) as nmem from cmdb_HyperV_Hosts where cluster ='".$cluster['cluster']."'"))[0]['nmem'];
$nb = (invoke_infra("select count(node) as nb from cmdb_HyperV_Hosts where cluster ='".$cluster['cluster']."'"))[0]['nb'];
$clmem = $clumem-32; if($nb == 4){$clmem = $clmem*2;}
$nodes = count($data);
$vms = 0;
$vm_mem = 0;
$disk = 0;
$io = 0;
$capacity = 0; $free = 0;
foreach ($data as $d) {
$vms += $d['vm_count'];
$vm_mem += $d['vm_memory'];
$node_mem = 0 + (int) $d['node_ram'];
foreach (explode("|", $d['csvs']) as $csv) {
if (instr($csv, ';')) {
$free += explode(";", $csv)[1] - explode(";", $csv)[2];
$disk = max($disk, $free);
$capacity += (int) explode(";", $csv)[1];
}
}
$io += $d['io_disk'];
}
$node_mem = $node_mem * count($data) / 2;
$io= round($io / count($data) * 1024);
if($io == 0){$io = "?";}
$vmleft = floor(($node_mem - 24 - $vm_mem) / 16);
$storageleft = floor($disk / 110);
$vmleft = min($vmleft, $storageleft);
$totalleft += $vmleft;
if ($vmleft > 2) {
$vleft = "<span class='text-success'><b>(" . $vmleft . "</b> VMs left)";
} elseif ($vmleft == 2) {
$vleft = "<span class='text-warning'><b>(" . $vmleft . "</b> VMs left)";
} else {
$vleft = "<span class='text-danger'><b>(" . $vmleft . "</b> VM left)";
}
?>
<div class='col-3'>
<a href="Cluster-detail.php?cluster=<?php echo $cluster['cluster']; ?>" class="text-decoration-none" target="_blank">
<div class='card border-secondary mb-3'>
<div class='card-header text-white bg-dark border-secondary'>
<h4>
<center><?php echo $cluster['cluster']; ?></center>
</h4>
<h6>
<center><b><?php echo $nodes; ?></b> Nodes / <b><?php echo $vms; ?></b> VMs <?php echo $vleft; ?></center>
</h6>
<?php
if((int)$nodes == 2 && $vms > 0){
$Repart = Invoke_Infra("select Owner, count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and decomtime is null group by Owner order by Owner");
$vmCountNode1 = $vmCountNode2 = 0;
$node1_name = $node2_name = "";
if(count($Repart) == 1 ){
$node1_name = $Repart[0]['Owner']; $vmCountNode1 = $Repart[0]['nbvm'];
}else{
$node1_name = 'DUN'; $vmCountNode1 = $Repart[0]['nbvm'];
$node2_name = 'MDK'; $vmCountNode2 = $Repart[1]['nbvm'];
}
$totalVMs = $vmCountNode1 + $vmCountNode2;
$percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0;
$percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0;
echo "<div class='progress' style='border: 2px solid grey; height: 20px;'>
<div class='progress-bar text-white' role='progressbar' style='width:$percentageNode1%' aria-valuenow='$percentageNode1' aria-valuemin='0' aria-valuemax='100'>
<b>$node1_name : $vmCountNode1 VMs</b>
</div>
<div class='progress-bar bg-info text-dark' role='progressbar' style='width:$percentageNode2%' aria-valuenow='$percentageNode2' aria-valuemin='0' aria-valuemax='100'>
<b>$node2_name : $vmCountNode2 VMs</b>
</div>
</div>";
}elseif((int)$nodes == 4){
$RepartD = Invoke_Infra("select count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and Owner like 'DUN%' and decomtime is null");
$RepartM = Invoke_Infra("select count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and Owner like 'MDK%' and decomtime is null");
$vmCountNode1 = $vmCountNode2 = 0;
$node1_name = 'DUN'; $vmCountNode1 = $RepartD[0]['nbvm'];
$node2_name = 'MDK'; $vmCountNode2 = $RepartM[0]['nbvm'];
$totalVMs = $vmCountNode1 + $vmCountNode2;
$percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0;
$percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0;
echo "<div class='progress' style='border: 2px solid grey; height: 20px;'>
<div class='progress-bar text-white' role='progressbar' style='width:$percentageNode1%' aria-valuenow='$percentageNode1' aria-valuemin='0' aria-valuemax='100'>
<b>$node1_name : $vmCountNode1 VMs</b>
</div>
<div class='progress-bar bg-info text-dark' role='progressbar' style='width:$percentageNode2%' aria-valuenow='$percentageNode2' aria-valuemin='0' aria-valuemax='100'>
<b>$node2_name : $vmCountNode2 VMs</b>
</div>
</div>";
}else{
echo "<div class='progress' style='border: 2px solid grey; height: 20px; background-Color: transparent;'>
<div class='progress-bar' style='width: 0%; background-color: transparent;'></div>
</div>";
}
?>
</div>
<div class='card-body text-white bg-dark'>
<?php
//Memory
echo "<div class='row'>";
echo "<div class='col-7'>";
echo "<b>Free Mem : </b>".($clmem - $vm_mem). " / " .$clmem. " GB";
echo "</div><div class='col-5'>";
$pcent = round(($clmem - $vm_mem)/$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 "
<div class='progress flex-grow-1' style='border: 2px solid $border; height: 20px;'>
<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></div>";
//DISK
echo "<div class='row'>";
echo "<div class='col-7'>";
$unit="GB";
if($capacity > 10000){
$capacity = round($capacity / 1024,1); $unit="TB";
$free = round($free / 1024,1);
}
$used = $capacity - $free;
echo "<b>Free CSV : </b>".$free. " / " .$capacity. " $unit";
echo "</div><div class='col-5'>";
$pcent = round(($free)/$capacity*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 "
<div class='progress flex-grow-1' style='border: 2px solid $border; height: 20px;'>
<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></div>";
echo "<div class='row'><div class='col-7'><b>CSV I/O</b> R/W (24h) :</div><div class='col-5'><b> $io KB/s</b></div></div>";
?>
</div>
</div>
</a>
</div>
<?php
$count++; }
?>
<br><br><h3><center>Total VM Left : <?php echo $totalleft;?> </center></h3>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>
<script>
$(".GaugeMeter").gaugeMeter();
</script>

185
X/StdOut-detail.php Normal file
View File

@@ -0,0 +1,185 @@
<!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 -->
<?php $script = $_GET['s']; ?>
<!-- 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 -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Script <b><?php echo $script; ?></b> Details</span></h1>
<!-- 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>
<?php // DATA
$aix=$linux=$dun=$azt=$other="Checked";
$where = " and OS_TYPE IN (";
if (isset($_GET['AIX'])) {if ($_GET['AIX'] == 1) {$aix = "Checked"; $where .= "'AIX',";} else {$aix = "Unchecked";}} else {$aix = "Unchecked";}
if (isset($_GET['linux'])) {if ($_GET['linux'] == 1) {$linux = "Checked"; $where .= "'LINUX',";} else {$linux = "Unchecked";}} else {$linux = "Unchecked";}
$where = rtrim($where,',').")";
$site = "";
if (isset($_GET['DUN'])) {if ($_GET['DUN'] == 1) {$dun = "Checked"; $site .= " or UPPER(HOSTNAME) like 'DUN%' or UPPER(HOSTNAME) like 'DMV%' or UPPER(HOSTNAME) like 'MDK%' or UPPER(HOSTNAME) like 'APPQPC%'";} else {$dun = "Unchecked";}} else {$dun = "Unchecked";}
if (isset($_GET['AZT'])) {if ($_GET['AZT'] == 1) {$azt = "Checked"; $site .=" or UPPER(HOSTNAME) like 'AZT%'";} else {$azt = "Unchecked";}} else {$azt = "Unchecked";}
if (isset($_GET['other'])) {if ($_GET['other'] == 1) {$other = "Checked"; $site .=" or UPPER(HOSTNAME) like 'BAD%' or UPPER(HOSTNAME) like 'FLO%' or UPPER(HOSTNAME) like 'MON%'";} else {$other = "Unchecked";}} else {$other = "Unchecked";}
$site = " and (".ltrim($site,' or').") ";
$where .= $site ;
$sql = "select hostname, os_type from srvall where decomtime is null and (ucase(filter) not like 'X_%' or filter is null) $where order by hostname";
$hosts = Invoke_aixcmdb($sql);
$taix=$aixok=$aixko=$tlinux=$linuxok=$linuxko=0;
#print_r($hosts);
?>
<form class="row">
<div class="col border rounded">
<b>Filters : </b>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="AIX" <?php echo $aix; ?>
name="AIX" value="1">
<label class="form-check-label" for="None">AIX</label>
</div>
&nbsp;
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="linux" <?php echo $linux; ?>
name="linux" value="1">
<label class="form-check-label" for="Manu">Linux</label>
</div>
&nbsp; | &nbsp;
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="DUN" <?php echo $dun; ?>
name="DUN" value="1">
<label class="form-check-label" for="Done">DMV/DUN/MDK</label>
</div>
&nbsp;
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="AZT" <?php echo $azt; ?>
name="AZT" value="1">
<label class="form-check-label" for="Done">Azure</label>
</div>
&nbsp;
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="other" <?php echo $other; ?>
name="other" value="1">
<label class="form-check-label" for="Done">Other</label>
</div>
<input type="hidden" name="s" value="<?php echo $script; ?>">
<button type="submit" class="btn btn-success btn-small mb-2 mt-2">Apply</button>
</div>
</form>
<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='host' data-sortable='true'>Host</th>
<th data-field='OS' data-sortable='true'>OS</th>
<th data-field='TimeStamp' data-sortable='true'>TimeStamp</th>
<th data-field='RC' data-sortable='true'>RC</th>
<th data-field='Result' data-sortable='true'>StdOut</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach($hosts as $h){
$host = strtoupper($h['HOSTNAME']);
$os = strtoupper($h['OS_TYPE']);
if(strtoupper($h['OS_TYPE']) == "AIX"){$taix++;}else{$tlinux++;}
$answer = Invoke_infra("SELECT * FROM x_stdout where cmd ='$script' and host ='$host'");
if(is_array($answer)){
$rc = $answer[0]['rc'];
$stdout = $answer[0]['stdout'];
$ts = $answer[0]['ts'];
if(strtoupper($h['OS_TYPE']) == "AIX"){
if($rc == 0 && (string)$rc <> ""){$aixok++;}else{if((string)$rc <> ""){$aixko++;}}
}else{
if($rc == 0 && (string)$rc <> ""){$linuxok++;}else{if((string)$rc <> ""){$linuxko++;}}
}
}else{
$rc=$stdout=$ts="";
}
echo "<tr><td><b>$host</b></td>";
echo "<td>$os</td>";
echo "<td>".$ts."</td>";
if($rc == 0 && (string)$rc <> ""){
echo "<td class='table-success'>".$rc."</td>";
}else{
if((string)$rc <> ""){
echo "<td class='table-danger'>".(string)$rc."</td>";
}else{
echo "<td></td>";
}
}
echo "<td>".$stdout."</td></tr>";
}
?>
</tbody>
<br>
<?php
$aixNO = $taix-$aixok-$aixko; $linuxNO=$tlinux-$linuxok-$linuxko;
echo "<div class='row'><div class='col text-center h4'><b>$taix AIX : </b>";
echo "<span class='badge bg-success'>$aixok</span>&nbsp;<span class='badge bg-danger'>$aixko</span>&nbsp;<span class='badge bg-secondary'>$aixNO</span></div>";
echo "<div class='col text-center h4'><b>$tlinux Linux : </b>";
echo "<span class='badge bg-success'>$linuxok</span>&nbsp;<span class='badge bg-danger'>$linuxko</span>&nbsp;<span class='badge bg-secondary'>$linuxNO</span></div></div> "; ?>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body>
<script src="/js/switch.js"></script>
</HTML>

86
X/StdOut.php Normal file
View File

@@ -0,0 +1,86 @@
<!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 -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Script Execution Follow-up</span></h1>
<!-- 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>
<?php // DATA
$answers = Invoke_infra("SELECT distinct(cmd),max(ts) from x_stdout group by cmd order by max(ts) desc");
echo "<div class='row'>";
foreach($answers as $cmd){
$ts = Invoke_infra("SELECT max(ts) as fin, min(ts) as debut FROM x_stdout where cmd = '".$cmd['cmd']."'");
echo "<div class='col-3 mb-3'><a href='StdOut-detail.php?s=".$cmd['cmd']."&AIX=1&linux=1&DUN=1' class='btn btn-primary btn-lg' role='button'>";
echo "<b>".$cmd['cmd']."</b><br><small>".$ts[0]['debut']." --> ".$ts[0]['fin']."</small>";
echo "</a></div> ";
}
echo "</div>";
?>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body>
<script src="/js/switch.js"></script>
</HTML>

View File

@@ -37,6 +37,7 @@
<li class="w-100">
<a href="/X/SVA-SCU.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- SVA/SCU Accounts</span></a>
<a href="/X/autoremediationlog.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- AutoRemediation Logs</span></a>
<a href="/X/stdout.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Scripts Result</span></a>
</li>
</ul>
</li>
@@ -56,6 +57,8 @@
<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/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/SYN-VMList.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Synergy VMs</span></a>
<a href="/Hyper-V/Legacy-VMList.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Legacy Hyper-V VMs</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>

View File

@@ -30,7 +30,7 @@
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?>
<?php // DATA
$windows = Invoke_Infra("select * from cmdb_srvall where DECOM is null and hostname not in (select server from maintenance_status where scom = 'Y' or zabbix = 'Y') order by hostname asc");
$windows = Invoke_Infra("select * from cmdb_srvall where DECOM is null and hostname not in (select server from maintenance_status where scom = 'Y' or zabbix = 'Y') and hostname <> '' order by hostname asc");
$linux = Invoke_aixcmdb("select h.hostname, h.hbtime, h.prevtime from heartbeat h left join srvall s on s.hostname = h.hostname where h.mainttime is null and h.decomtime is null and s.os_type = 'LINUX' order by h.hostname");
$aix = Invoke_aixcmdb("select h.hostname, h.hbtime, h.prevtime from heartbeat h left join srvall s on s.hostname = h.hostname where h.mainttime is null and h.decomtime is null and s.os_type = 'AIX' order by h.hostname");
$other = Invoke_aixcmdb("select h.hostname, h.hbtime, h.prevtime from heartbeat h left join srvall s on s.hostname = h.hostname where h.mainttime is null and h.decomtime is null and s.os_type is null order by h.hostname");