This commit is contained in:
e025532
2025-04-22 09:08:30 +02:00
parent c15a86d6a8
commit 20e3d5a1b0
15 changed files with 20853 additions and 468 deletions

View File

@@ -47,26 +47,9 @@
<!-- 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">
<table class='table table-bordered table-hover table-sm' id='t1' data-height="820" 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>
@@ -95,6 +78,9 @@
if($row['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
}
if($row['DynamicVHD'] == "Y"){
echo '<span class="badge rounded-pill bg-secondary text-warning">Dyn. VHDX</span> ';
}
echo "</td>";
# Prefered Owner
if($row['Owner'] == $row['PreferredOwner']){
@@ -124,7 +110,7 @@
echo "</tr>";
}
?>
</tbody>
</tbody>
</table>
<br>
</div>
@@ -138,28 +124,30 @@
</HTML>
<SCRIPT>
$(document).ready(function() {
$('#t1').DataTable({
scrollY: '50vh',
scrollCollapse: true,
paging: false,
$(function() {
// Exécution initiale pour définir la hauteur
adjustTableHeight();
// Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight();
});
function adjustTableHeight() {
var windowHeight = $(window).height();
var tableTop = $('#t1').offset().top;
var footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
var availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
$('#t1').bootstrapTable('refreshOptions', {
height: availableHeight
});
});
}
});
$(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

@@ -79,7 +79,7 @@
<tbody> <!-- Body -->
<?php
$wrongOwner = $unclustered = $v10 = 0 ; $msg ="" ; $CpuComp = 0;
$wrongOwner = $unclustered = $v10 = 0 ; $msg ="" ; $CpuComp = 0; $DynVHD = 0;
foreach ($answers as $row) {
echo "<tr>";
# Name
@@ -99,6 +99,9 @@
if($row['CPUcomp'] == "True"){
echo '<span class="badge rounded-pill bg-warning text-dark">CPU Comp.</span> '; $CpuComp++;
}
if($row['DynamicVHD'] == "Y"){
echo '<span class="badge rounded-pill bg-secondary text-warning">Dyn. VHDX</span> '; $DynVHD++;
}
echo "</td>";
# Prefered Owner
if($row['Owner'] == $row['PreferredOwner']){
@@ -136,6 +139,7 @@
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>";}
if($DynVHD > 0){$msg .= "&nbsp;<span class='badge bg-secondary text-warning'>$DynVHD VM(s) With Dynamic VHDx</span>";}
?>
</tbody>
</table>
@@ -151,27 +155,29 @@
</HTML>
<SCRIPT>
$(document).ready(function() {
$('#t1').DataTable({
scrollY: '50vh',
scrollCollapse: true,
paging: false,
$(function() {
// Exécution initiale pour définir la hauteur
adjustTableHeight();
// Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight();
});
function adjustTableHeight() {
var windowHeight = $(window).height();
var tableTop = $('#t1').offset().top;
var footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
var availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
$('#t1').bootstrapTable('refreshOptions', {
height: availableHeight
});
});
$(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>" ; ?>";

View File

@@ -1,171 +0,0 @@
<!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

@@ -1,233 +0,0 @@
<!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>

293
Inventory/Server-Detail.php Normal file
View File

@@ -0,0 +1,293 @@
<!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>
<!-- Blink -->
<style>
@keyframes blink {
0% { opacity: 1; }
50% { opacity: 0.25; }
100% { opacity: 1; }
}
.blinking {
animation: blink 1.2s infinite;
}
</style>
</head>
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/all.php" ; ?>
<?php
//GET-DATAS
$server = $_GET['s'];
$Qw = Invoke_Infra("select * from cmdb_srvall where hostname = '$server'");
$Qx = Invoke_Infra("select * from X_srvall where hostname = '$server'");
$Qvm = Invoke_Infra("select * from cmdb_vms where Name = '$server'");
//if(!(is_array($Qw) || is_array($Qx) || is_array($Qvm) )){$notfound = 1;}else{$notfound = 0;}
$notfound = ! (is_array($Qw) || is_array($Qx) || is_array($Qvm));
// OS
if(is_array($Qw)){
$OSType = "Windows"; $OSName = $Qw[0]['os']; $OSKernel = "";
}else{
if($Qx[0]['Type'] == "AIX"){
$OSType = "AIX"; $OSName = "AIX ".$Qx[0]['OSVersion'] ; $OSKernel = "";
}else{
$OSType = "Linux"; $OSName = $Qx[0]['Type']." ".$Qx[0]['OSVersion'] ; $OSKernel = $Qx[0]['Kernel'];
}
}
echo "<div id='type' data-value='".strtolower($OSType)."' hidden></div>";
echo "<div id='computer' data-value='$server' hidden></div>";
// Memory & CPU
if($OSType == "Windows"){
$memory = $Qw[0]['memory']." GB";$cpu = $Qw[0]['cpu'];
}else{
$cpu = $Qx[0]['CPU'] ;
if($OSType == "AIX"){
$memory = round(str_replace(" Mo","",$Qx[0]['Memory'])/1024,2)." GB";
}else{
$memory = $Qvm[0]['Memory'];
}
}
echo "<div id='type' data-value='".strtolower($OSType)."' hidden></div>";
echo "<div id='computer' data-value='$server' hidden></div>";
?>
<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 -->
<?php
//DECOM ???
if($notfound == 1){
echo '<h1><span class="badge text-bg-danger font-weight-bold" style="width:100%;">'. strtoupper($server) .' : NOT FOUND !</span></h1>';
echo '<script src="/js/switch.js"></script>';
echo "</div></div></body></HTML>";
exit;
}
if(strpos($Qw[0]['DECOM'],'-') != false || strpos($Qx[0]['Decom'],'-') != false){
echo '<h1><span class="badge text-bg-danger font-weight-bold blinking" style="width:100%;">'. strtoupper($server) .' : DECOMMISSIONED !</span></h1>';
echo '<script src="/js/switch.js"></script>';
echo "</div></div></body></HTML>";
exit;
}else{
echo '<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">' . strtoupper($server) .'</span></h1>';
}
?>
<!-- Main content -->
<!-- OS, Host, Site, Maintenance -->
<div id="OS" class="fs-4">
<span class="badge rounded-pill bg-secondary text-light"><?= $OSName ?></span>
<?php if($OSKernel){echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light'>$OSKernel</span>";} ?>
<?php
if(is_array($Qvm)){
$site = Invoke_Infra("SELECT site from cmdb_physical_site where hostname ='".$Qvm[0]['Owner']."'")[0]['site'];
if($Qvm[0]['Owner'] == $Qvm[0]['PreferredOwner']){
echo "&nbsp;<span class='badge rounded-pill bg-success text-light'>Host : ".$Qvm[0]['Owner']."</span>";
}else{
echo "&nbsp;<span class='badge rounded-pill bg-warning text-dark'>Host : ".$Qvm[0]['Owner']."</span>";
}
}else{
if(is_array($Qx)){
echo "&nbsp;<span class='badge rounded-pill bg-success text-light'>Host : ".$Qx[0]['Owner']."</span>";
$site = substr($Qx[0]['Owner'],0,3);
}else{
echo "&nbsp;<span class='badge rounded-pill bg-success text-light'>Physical</span>";
}
}
?>
<?php if(isset($site)){echo "<span class='badge rounded-pill bg-secondary text-light'>Site : $site</span>";} ?>
<?php if(is_array($Qvm) && $Qvm[0]['IsClustered'] != 'True'){echo "&nbsp;<span class='badge rounded-pill bg-warning text-dark'>Unclustered VM</span>";} ?>
<?php
$m = Invoke_Infra("select * from Maintenance_Status where server ='$server'");
if($m[0]['scom'] == "Y" || $m[0]['zabbix'] == "Y" || $m[0]['aixcmdb'] == "Y"){
echo "&nbsp;<span class='badge rounded-pill bg-primary text-dark blinking'>Maintenance ON</span>";
}
?>
</div>
<hr>
<!-- CPU & Memory -->
<div class="row" id="perf">
<div class="chart-container col">
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-5 bg-info">
<i class="fs-7 bi-cpu text-black"></i><b> CPU : <?= $cpu ?></b>
<?php if(is_array($Qvm)){if($Qvm[0]['CPUcomp'] == "True"){echo '<span class="badge rounded-pill bg-warning text-dark">VM CPU compatibility checked</span> ';}} ?>
</div>
<div class="card-body bg-dark fs-4">
<canvas id="cpuChart"></canvas>
</div>
</div>
</div>
<div class="chart-container col">
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-5 bg-info">
<i class="fs-7 bi-memory text-black"></i><b> Memory : <?= $memory ?></b>
</div>
<div class="card-body bg-dark fs-4">
<canvas id="ramChart"></canvas>
</div>
</div>
</div>
<script src="fillchart.js"></script>
</div>
<!-- Drives -->
<?php
// LUNs ?
$luns = Invoke_WebInfraTools("select count(*) as lun from storage_lun where hostname = '$server'");
if($luns[0]['lun'] >0 || $Qvm[0]['WWPNs'] != ""){
$wwpns = "";
if($luns[0]['lun'] == 0){$luns = "Some LUNs are owned by cluster";}else{$luns = $luns[0]['lun']." LUNs";}
if(is_array($Qvm)){$wwpns = str_replace("|",", ",$Qvm[0]['WWPNs']);}
echo "<center><span class='badge rounded-pill bg-primary text-light fs-5'>".$luns."</span>";
if($wwpns != ""){echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>WWPNs :".$wwpns."</span></center><br>";}else{echo "</center><br>";}
}
?>
<div class="row" id="drives">
<?php
// Drives
$drives = explode("|",$Qw[0]['drives']);
if($drives[0] === "O"){$drives = explode("|",$Qx[0]['Drives']);}
if($drives[0] != "O" && $drives[0] != ""){
foreach($drives as $drive){
echo "<div class='col-6'><div class='row'>";
$data = explode(",",$drive);
echo "<div class='col-3'><b>".$data[0]."</b> : ".round($data[2])."/<b>".$data[1]." GB</b></div>";
$pcent = ($data[1] - $data[2])/$data[1]*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='col-9'>
<div class='progress flex-grow-1' style='border: 2px solid $border; height: 20px; min-width: 150px;'>
<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>";
echo "</div></div>";
}
}
?>
</div>
<hr>
<!-- Last boot, last rollup, next rollup -->
<?php
if(is_array($Qw) && $Qw[0]['lastBoot'] != ""){
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>Last Boot : ".$Qw[0]['lastBoot']."</span>";
}elseif(is_array($Qx) && $Qx[0]['LastBoot'] != ""){
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>Last Boot : ".$Qx[0]['LastBoot']."</span>";
}
if(is_array($Qw) && $Qw[0]['LastKBUpdate'] != ""){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>Last Update : ".$Qw[0]['LastKBUpdate']."</span>";
}elseif(is_array($Qx) && $Qx[0]['LastUpdate'] != ""){
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>Last Update : ".$Qx[0]['LastUpdate']."</span>";
}
if($OSType == "Windows"){
$date = Invoke_Entry01("select next from rollupdate where Server='$server'");
if(is_array($date)){
if($date != ""){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>Next Rollup : ".$date[0]['next']."</span>";
}
}
}
if($OSType == "Linux"){
$date = Invoke_Infra("select Next from rollup_linux_calendar where Server='$server'")[0]['Next'];
if($date != ""){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>Next Rollup : $date </span>";
}
}
?>
<hr>
<!-- Last boot, last rollup, next rollup -->
<?php
if(is_array($Qw)){
if(strpos($Qw[0]['zabbix'],'.') != false){
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>Zabbix : ".$Qw[0]['zabbix']."</span>";
}else{
echo "<span class='badge rounded-pill bg-warning text-dark fs-5'>Zabbix : Not Installed</span>";
}
if(strpos($Qw[0]['sentinel'],'.') != false){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>SentinelOne : ".$Qw[0]['sentinel']."</span>";
}else{
echo "&nbsp;<span class='badge rounded-pill bg-warning text-dark fs-5'>SentinelOne : Not Installed</span>";
}
if(strpos($Qw[0]['zabbix'],'.') != false){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>Nessus : ".$Qw[0]['nessus']."</span>";
}else{
echo "&nbsp;<span class='badge rounded-pill bg-warning text-dark fs-5'>Nessus : Not Installed</span>";
}
}
if(is_array($Qx)){
$a = Invoke_Infra("select * from X_cmdb_Product where HOSTNAME='$server' and Name ='zabbix'");
if(is_array($a) && strpos($a[0]['Ver'],'.') != false){
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>Zabbix : ".$a[0]['Ver']." - ".$a[0]['State']."</span>";
}else{
echo "<span class='badge rounded-pill bg-warning text-dark fs-5'>Zabbix : Not Installed</span>";
}
$a = Invoke_Infra("select * from X_cmdb_Product where HOSTNAME='$server' and Name ='s1'");
if(is_array($a) && strpos($a[0]['Ver'],'.') != false){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>SentinelOne : ".$a[0]['Ver']." - ".$a[0]['State']."</span>";
}else{
echo "&nbsp;<span class='badge rounded-pill bg-warning text-dark fs-5'>SentinelOne : Not Installed</span>";
}
$a = Invoke_Infra("select * from X_cmdb_Product where HOSTNAME='$server' and Name ='nessus'");
if(is_array($a) && strpos($a[0]['Ver'],'.') != false){
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>Nessus : ".$a[0]['Ver']." - ".$a[0]['State']."</span>";
}else{
echo "&nbsp;<span class='badge rounded-pill bg-warning text-dark fs-5'>Nessus : Not Installed</span>";
}
}
?>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>

57
Inventory/Z_data_aix.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
// Zabbix DB
$host = 'aztprdzabbix52.armony.net';
$dbname = 'zabbix';
$user = 'patrick';
$pass = 'showZabbix@dash1';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$server = strtolower($_GET['c']);
$now = time();
$past_24h = $now - 86400; // 24H
//Get Host ID
$hostQuery = "SELECT hostid, name FROM hosts WHERE name = :server";
$hostStmt = $pdo->prepare($hostQuery);
$hostStmt->execute(['server' => $server]);
$host = $hostStmt->fetch();
$hostId = $host['hostid'];
// Récupération des identifiants d'items pour CPU et mémoire
$itemQuery = "SELECT itemid, name, value_type FROM items
WHERE hostid = :hostid
AND (name LIKE '%Memory utilization%' OR name LIKE '%CPU logical processor utilization%')";
$itemStmt = $pdo->prepare($itemQuery);
$itemStmt->execute(['hostid' => $hostId]);
$items = $itemStmt->fetchAll();
$data = [];
// Get CPU & Memory Items
foreach ($items as $item) {
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
// Get History Data
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
AVG(value) AS avg_value
FROM $table
WHERE itemid = :itemid AND clock BETWEEN :start AND :end
GROUP BY FLOOR(clock / 600)
ORDER BY clock";
$stmt = $pdo->prepare($sql);
$stmt->execute(['itemid' => $item['itemid'], 'start' => $past_24h, 'end' => $now]);
$results = $stmt->fetchAll();
// Format Data
foreach ($results as &$row) {
$row['avg_value'] = $isMemory ?
floatval($row['avg_value']) :
round(floatval($row['avg_value']), 2);
}
$data[$item['name']] = $results;
}
// Send Json back
echo json_encode($data, JSON_NUMERIC_CHECK);
?>

View File

@@ -0,0 +1,57 @@
<?php
// Zabbix DB
$host = 'aztprdzabbix52.armony.net';
$dbname = 'zabbix';
$user = 'patrick';
$pass = 'showZabbix@dash1';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$server = strtolower($_GET['c']);
$now = time();
$past_24h = $now - 86400; // 24H
//Get Host ID
$hostQuery = "SELECT hostid, name FROM hosts WHERE name = :server";
$hostStmt = $pdo->prepare($hostQuery);
$hostStmt->execute(['server' => $server]);
$host = $hostStmt->fetch();
$hostId = $host['hostid'];
// Récupération des identifiants d'items pour CPU et mémoire
$itemQuery = "SELECT itemid, name, value_type FROM items
WHERE hostid = :hostid
AND (name LIKE '%Memory utilization%' OR name LIKE '%CPU utilization%')";
$itemStmt = $pdo->prepare($itemQuery);
$itemStmt->execute(['hostid' => $hostId]);
$items = $itemStmt->fetchAll();
$data = [];
// Get CPU & Memory Items
foreach ($items as $item) {
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
// Get History Data
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
AVG(value) AS avg_value
FROM $table
WHERE itemid = :itemid AND clock BETWEEN :start AND :end
GROUP BY FLOOR(clock / 600)
ORDER BY clock";
$stmt = $pdo->prepare($sql);
$stmt->execute(['itemid' => $item['itemid'], 'start' => $past_24h, 'end' => $now]);
$results = $stmt->fetchAll();
// Format Data
foreach ($results as &$row) {
$row['avg_value'] = $isMemory ?
floatval($row['avg_value']) :
round(floatval($row['avg_value']), 2);
}
$data[$item['name']] = $results;
}
// Send Json back
echo json_encode($data, JSON_NUMERIC_CHECK);
?>

View File

@@ -0,0 +1,57 @@
<?php
// Zabbix DB
$host = 'aztprdzabbix52.armony.net';
$dbname = 'zabbix';
$user = 'patrick';
$pass = 'showZabbix@dash1';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$server = strtoupper($_GET['c']);
$now = time();
$past_24h = $now - 86400; // 24H
//Get Host ID
$hostQuery = "SELECT hostid, name FROM hosts WHERE name = :server";
$hostStmt = $pdo->prepare($hostQuery);
$hostStmt->execute(['server' => $server]);
$host = $hostStmt->fetch();
$hostId = $host['hostid'];
// Récupération des identifiants d'items pour CPU et mémoire
$itemQuery = "SELECT itemid, name, value_type FROM items
WHERE hostid = :hostid
AND (name LIKE '%Memory utilization%' OR name LIKE '%CPU utilization%')";
$itemStmt = $pdo->prepare($itemQuery);
$itemStmt->execute(['hostid' => $hostId]);
$items = $itemStmt->fetchAll();
$data = [];
// Get CPU & Memory Items
foreach ($items as $item) {
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
// Get History Data
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
AVG(value) AS avg_value
FROM $table
WHERE itemid = :itemid AND clock BETWEEN :start AND :end
GROUP BY FLOOR(clock / 600)
ORDER BY clock";
$stmt = $pdo->prepare($sql);
$stmt->execute(['itemid' => $item['itemid'], 'start' => $past_24h, 'end' => $now]);
$results = $stmt->fetchAll();
// Format Data
foreach ($results as &$row) {
$row['avg_value'] = $isMemory ?
floatval($row['avg_value']) :
round(floatval($row['avg_value']), 2);
}
$data[$item['name']] = $results;
}
// Send Json back
echo json_encode($data, JSON_NUMERIC_CHECK);
?>

98
Inventory/fillchart.js Normal file
View File

@@ -0,0 +1,98 @@
let typ = document.getElementById("type").dataset.value;
let computer = document.getElementById("computer").dataset.value;
async function fetchAndDisplayData() {
try {
const response = await fetch(`z_data_${typ}.php?c=${computer}`);
const jsonData = await response.json();
const data = jsonData.data || jsonData;
const cpuKey = Object.keys(data).find(key => key.includes('CPU'));
const ramKey = Object.keys(data).find(key => key.includes('Memory'));
const labels = [];
if (cpuKey && data[cpuKey]) {
data[cpuKey].forEach(point => {
if (!labels.includes(point.datetime)) {
labels.push(point.datetime);
}
});
}
if (ramKey && data[ramKey]) {
data[ramKey].forEach(point => {
if (!labels.includes(point.datetime)) {
labels.push(point.datetime);
}
});
}
labels.sort();
const cpuDataMap = {};
const ramDataMap = {};
if (cpuKey && data[cpuKey]) {
data[cpuKey].forEach(point => {
cpuDataMap[point.datetime] = parseFloat(point.avg_value);
});
}
if (ramKey && data[ramKey]) {
data[ramKey].forEach(point => {
ramDataMap[point.datetime] = parseFloat(point.avg_value);
});
}
const cpuChartData = labels.map(label => cpuDataMap[label] || null);
const ramChartData = labels.map(label => ramDataMap[label] || null);
const formattedLabels = labels.map(label => {
const date = new Date(label);
return date.toLocaleTimeString('fr-FR', {hour: '2-digit', minute: '2-digit'});
});
if (cpuKey && data[cpuKey] && data[cpuKey].length > 0) {
const ctx1 = document.getElementById('cpuChart').getContext('2d');
new Chart(ctx1, {
type: 'line',
data: {
labels: formattedLabels,
datasets: [{
label: 'CPU (%)',
data: cpuChartData,
borderColor: 'rgb(54, 162, 235)',
backgroundColor: 'rgba(54, 162, 235, 0.1)',
fill: true,
tension: 0.3,
pointRadius: 0
}]
},
options: {
legend: {display: false},
responsive: true,
maintainAspectRatio: false,
scales: {y: {beginAtZero: true}}
}
});
}
if (ramKey && data[ramKey] && data[ramKey].length > 0) {
const ctx2 = document.getElementById('ramChart').getContext('2d');
new Chart(ctx2, {
type: 'line',
data: {
labels: formattedLabels,
datasets: [{
label: 'Memory (%)',
data: ramChartData,
borderColor: 'rgb(54, 162, 235)',
backgroundColor: 'rgba(54, 162, 235, 0.1)',
fill: true,
tension: 0.3,
pointRadius: 0
}]
},
options: {
legend: {display: false},
responsive: true,
maintainAspectRatio: false,
scales: {y: {beginAtZero: true}}
}
});
}
} catch (error) {
console.error('Erreur:', error);
}
}
window.addEventListener('load', fetchAndDisplayData);

View File

@@ -0,0 +1,24 @@
<?php
header('Content-Type: application/json');
include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.inc.php" ;
if (isset($_GET['term'])) {
$term = $_GET['term'];
$query = "SELECT hostname AS serv FROM cmdb_srvall WHERE hostname LIKE '%$term%' UNION SELECT hostname AS serv FROM x_SRVALL WHERE hostname LIKE '%$term%'";
$user = "INFRA_dbo";
$pwd = "Q3pUz2x9YL2r6k";
$server = "DUN-PRD-R1MSSQL.armony.net\PRD";
$database = "INFRA";
$conn = odbc_connect("Driver={SQL Server};Server=$server;Database=$database;", $user, $pwd);
$rs = odbc_exec($conn, $query);
while ($row = odbc_fetch_array($rs)) {
$servers[] = $row;
}
$result = [];
if (is_array($servers)) {
foreach ($servers as $server) {
$result[] = $server['serv'];
}
}
echo json_encode($result);
}
?>

1311
css/autocomplete.css Normal file

File diff suppressed because it is too large Load Diff

18706
js/JQueryUI.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,10 @@
<!--
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
-->
<link rel="stylesheet" href="/css/autocomplete.css">
<script src="/js/jqueryui.js"></script>
<div class="d-flex flex-column align-items-center align-items-sm-start px-3 pt-2 text-white min-vh-100 border-end border-primary">
<a href="/" class="d-flex align-items-center pb-3 mb-md-0 me-md-auto text-white text-decoration-none">
<span class="fs-5 d-none d-sm-inline text-primary h3">INFRA REPORTS IT</span>
@@ -10,6 +17,10 @@
<input class="form-check-input" type="checkbox" id="lightSwitch" />
</div>
<div class="position-relative bottom-0 start-0 p-3">
<input type="text" id="searchServer" class="form-control" placeholder="Server Search..." style="font-size: 0.75rem !important">
</div>
<ul class="nav nav-pills flex-column mb-sm-auto mb-0 align-items-center align-items-sm-start" id="menu">
<li class="nav-item">
<a href="/index.php" class="nav-link align-middle px-0">
@@ -105,7 +116,27 @@
</li>
</ul>
<hr>
<br>
<br>
</div>
<script>
$(document).ready(function() {
$("#searchServer").autocomplete({
source: "/search_servers.php",
minLength: 2,
appendTo: "body",
position: { my: "left top", at: "left bottom-10" },
select: function(event, ui) {
window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(ui.item.value);
}
});
$("#searchServer").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
var selectedServer = $(this).val().trim();
if (selectedServer !== "") {
window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(selectedServer);
}
}
});
});
</script>

137
navbar2.html Normal file
View File

@@ -0,0 +1,137 @@
<div class="d-flex flex-column align-items-center align-items-sm-start px-3 pt-2 text-white min-vh-100 border-end border-primary">
<a href="/" class="d-flex align-items-center pb-3 mb-md-0 me-md-auto text-white text-decoration-none">
<span class="fs-5 d-none d-sm-inline text-primary h3">INFRA REPORTS IT</span>
</a>
<div class="form-check form-switch ms-auto mt-3 me-3">
<label class="form-check-label ms-3" for="lightSwitch">
<i class="bi bi-sun"></i>/<i class="bi bi-moon"></i>
</label>
<input class="form-check-input" type="checkbox" id="lightSwitch" />
</div>
<div class="position-relative bottom-0 start-0 p-3">
<input type="text" id="searchServer" class="form-control" placeholder="Server Search..." style="font-size: 0.75rem !important">
</div>
<ul class="nav nav-pills flex-column mb-sm-auto mb-0 align-items-center align-items-sm-start" id="menu">
<li class="nav-item">
<a href="/index.php" class="nav-link align-middle px-0">
<i class="fs-6 bi-house text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Home</span>
</a>
</li>
<li>
<a href="/crossover/GlobalCrossover.php" class="nav-link px-0 align-middle">
<i class="fs-6 bi-table text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">DB Crossover</span></a>
</li>
<li>
<a href="#SharedFolders" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-folder-symlink-fill text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Shared Folders</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="SharedFolders" data-bs-parent="#menu">
<li class="w-100">
<a href="/shared-folders/eqp-prj.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- PRJ & EQP Folders</span></a>
<a href="/shared-folders/homedirectories.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- HomeDirectories</span></a>
</li>
</ul>
</li>
<li>
<a href="#Unix" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-pc text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Unix/Linux</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="Unix" data-bs-parent="#menu">
<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>
<li>
<a href="#rollup" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-calendar text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Rollups</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="rollup" data-bs-parent="#menu">
<li class="w-100">
<a href="/Rollups/rollup-calendar.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Full Calendar</span></a>
</li>
</ul>
</li>
<li>
<a href="#HyperV" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-pc text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Hyper-V</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="HyperV" data-bs-parent="#menu">
<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>
</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>
<a href="/Storage/orphanluns.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- SVC Orphan LUNs</span></a>
</li>
</ul>
</li>
<li>
<a href="#Workstation" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-pc-display-horizontal text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Workstations</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="Workstation" data-bs-parent="#menu">
<li class="w-100">
<a href="/workstation/globalcrossover.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Crossover</span></a>
</li>
</ul>
</li>
<li>
<a href="#Heartbeat" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-activity text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Heartbeat</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="Heartbeat" data-bs-parent="#menu">
<li class="w-100">
<a href="/reports/heartbeat.php" class="nav-link px-0" target="_blank"> <span class="d-none d-sm-inline text-white h7">- Heartbeat Map</span></a>
</li>
</ul>
</li>
<br>
<br>
<li>
<a href="#link" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-link text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">Links</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="link" data-bs-parent="#menu">
<li class="w-100">
<a href="http://dash-dtd-systemdk.appliarmony.net/index-it-dark.html" class="nav-link px-0" target="_blank"> <span class="d-none d-sm-inline text-white h7">- Dashboard IT</span></a>
<a href="http://dash-dtd-systemdk.appliarmony.net/index-ot-dark.html" class="nav-link px-0" target="_blank"> <span class="d-none d-sm-inline text-white h7">- Dashboard OT</span></a>
</li>
</ul>
</li>
</ul>
<hr>
</div>
<script>
$(document).ready(function() {
$("#searchServer").autocomplete({
source: "search_servers.php",
minLength: 3,
appendTo: "body",
position: { my: "left top", at: "left bottom-10" },
select: function(event, ui) {
// Redirige immédiatement après la sélection
window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(ui.item.value);
}
});
$("#searchServer").keypress(function(event) {
if (event.which == 13) { // Code 13 = Entrée
event.preventDefault(); // Empêche le comportement par défaut
var selectedServer = $(this).val().trim();
if (selectedServer !== "") {
window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(selectedServer);
}
}
});
});
</script>

24
search_servers.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
header('Content-Type: application/json');
include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.inc.php" ;
if (isset($_GET['term'])) {
$term = $_GET['term'];
$query = "SELECT hostname AS serv FROM cmdb_srvall WHERE hostname LIKE '%$term%' UNION SELECT hostname AS serv FROM x_SRVALL WHERE hostname LIKE '%$term%'";
$user = "INFRA_dbo";
$pwd = "Q3pUz2x9YL2r6k";
$server = "DUN-PRD-R1MSSQL.armony.net\PRD";
$database = "INFRA";
$conn = odbc_connect("Driver={SQL Server};Server=$server;Database=$database;", $user, $pwd);
$rs = odbc_exec($conn, $query);
while ($row = odbc_fetch_array($rs)) {
$servers[] = $row;
}
$result = [];
if (is_array($servers)) {
foreach ($servers as $server) {
$result[] = $server['serv'];
}
}
echo json_encode($result);
}
?>