Remove unused PHP files related to Hyper-V and Storage dashboards

- Deleted `cluster-detail2.php`, `constants.inc copy.php`, `D.php`, and `Dashboard2.php`. These files were no longer in use and contributed to unnecessary clutter in the codebase.
- Cleaned up references to removed files.
This commit is contained in:
e025532
2025-07-29 14:02:06 +02:00
parent 1f794e2273
commit 5c7ea9f3fc
70 changed files with 14141 additions and 6259 deletions

14
.idea/deployment.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="infra-reports">
<serverData>
<paths name="infra-reports">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

6
.idea/jsLibraryMappings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<excludedPredefinedLibrary name="HTML" />
</component>
</project>

7
.idea/php.xml generated
View File

@@ -10,7 +10,12 @@
<option name="highlightLevel" value="WARNING" /> <option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.0"> <component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/../../Include" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.3">
<option name="suggestChangeDefaultLanguageLevel" value="false" /> <option name="suggestChangeDefaultLanguageLevel" value="false" />
</component> </component>
<component name="PhpStanOptionsConfiguration"> <component name="PhpStanOptionsConfiguration">

1
.idea/sqldialects.xml generated
View File

@@ -2,7 +2,6 @@
<project version="4"> <project version="4">
<component name="SqlDialectMappings"> <component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/X/StdOut.php" dialect="GenericSQL" /> <file url="file://$PROJECT_DIR$/X/StdOut.php" dialect="GenericSQL" />
<file url="file://$PROJECT_DIR$/crossover/GlobalCrossover2.php" dialect="GenericSQL" />
<file url="PROJECT" dialect="GenericSQL" /> <file url="PROJECT" dialect="GenericSQL" />
</component> </component>
</project> </project>

View File

@@ -6,5 +6,7 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jquery" level="application" />
<orderEntry type="library" name="@types/jquery" level="application" />
</component> </component>
</module> </module>

14
.idea/webResources.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebResourcesPaths">
<contentEntries>
<entry url="file://$PROJECT_DIR$">
<entryData>
<resourceRoots>
<path value="file://$PROJECT_DIR$" />
</resourceRoots>
</entryData>
</entry>
</contentEntries>
</component>
</project>

View File

@@ -1,15 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports IT</title> <title>Web Infra Reports IT</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
@@ -24,49 +21,55 @@
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Group Review</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Group Review</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<?php // DATA <?php
$teams = Invoke_Infra("SELECT distinct equipe FROM Group_Review_SOX"); $all_groups = Invoke_Infra(" SELECT equipe, Groupe, Tiering, Members FROM Group_Review_SOX ORDER BY equipe, groupe");
foreach ($teams as $team) { $grouped_by_team = [];
echo "<h2 class='text-center'>".$team['equipe']."</h2>"; foreach ($all_groups as $group) {
$groups = Invoke_Infra("SELECT * FROM Group_Review_SOX WHERE equipe = '".$team['equipe']."' order by groupe"); $team_name = $group['equipe'];
foreach($groups as $group) { if (!isset($grouped_by_team[$team_name])) {
echo "<h3>".$group['Groupe']."</h3>"; $grouped_by_team[$team_name] = [];
echo "<h4>".$group['Tiering']."</h4>";
echo " - ".str_replace("),",")<br> - ",$group['Members']);
echo "<br><br>";
}
echo "<hr>";
} }
?> $grouped_by_team[$team_name][] = $group;
<div> }
<br> foreach ($grouped_by_team as $team_name => $groups_in_team) {
</div> echo "<h2 class='text-center'>" . htmlspecialchars($team_name) . "</h2>";
foreach ($groups_in_team as $group_data) {
echo "<h3>" . htmlspecialchars($group_data['Groupe']) . "</h3>";
echo "<h4>" . htmlspecialchars($group_data['Tiering']) . "</h4>";
$formatted_members = str_replace("),", ")<br> - ", htmlspecialchars($group_data['Members']));
echo " - " . $formatted_members;
echo "<br><br>";
}
echo "<hr>";
}
?>
<div>
<br>
</div> </div>
<!-- End of main content -->
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>

View File

@@ -29,77 +29,77 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Group Membership</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Group Membership</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<?php // DATA <?php // DATA
// Fetch all unique group names for the autocomplete // Fetch all unique group names for the autocomplete
$group_query = Invoke_Infra("SELECT DISTINCT grp FROM AD_GroupMembership ORDER BY grp"); $group_query = Invoke_Infra("SELECT DISTINCT grp FROM AD_GroupMembership ORDER BY grp");
$groups = []; $groups = [];
foreach ($group_query as $row) { foreach ($group_query as $row) {
$groups[] = $row['grp']; $groups[] = $row['grp'];
} }
?> ?>
<div> <div>
<br> <br>
</div>
<form id="search-form" class="mb-4" method="POST" action="">
<div class="row">
<div class="col-md-6">
<label for="group-search" class="form-label">Search AD Group</label>
<input type="text" class="form-control" id="group-search" name="group-search" placeholder="Start typing group name ...">
</div>
<div class="col-md-2 d-flex align-items-end">
<button type="submit" class="btn btn-primary w-100">Show Members</button>
</div>
</div>
</form>
<?php
if(isset($_POST['group-search'])) {
echo "<h2 class='text-center'>".$_POST['group-search']."</h2>";
$members = Invoke_Infra("SELECT * FROM AD_GroupMembership WHERE grp = '".$_POST['group-search']."'");
echo "<h3 class='text-center'>".$members[0]['descr']."</h3>";
echo " - ".str_replace(" | ","<br> - ",$members[0]['members']);
}
?>
</div> </div>
<!-- End of main content -->
<form id="search-form" class="mb-4" method="POST" action="">
<div class="row">
<div class="col-md-6">
<label for="group-search" class="form-label">Search AD Group</label>
<input type="text" class="form-control" id="group-search" name="group-search" placeholder="Start typing group name ...">
</div>
<div class="col-md-2 d-flex align-items-end">
<button type="submit" class="btn btn-primary w-100">Show Members</button>
</div>
</div>
</form>
<?php
if(isset($_POST['group-search'])) {
echo "<h2 class='text-center'>".$_POST['group-search']."</h2>";
$members = Invoke_Infra("SELECT * FROM AD_GroupMembership WHERE grp = '".$_POST['group-search']."'");
echo "<h3 class='text-center'>".$members[0]['descr']."</h3>";
echo " - ".str_replace(" | ","<br> - ",$members[0]['members']);
}
?>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script> <script>
$(function() { $(function() {
const availableGroups = <?php echo json_encode($groups); ?>; const availableGroups = <?php echo json_encode($groups); ?>;
const groupSearchInput = $('#group-search'); const groupSearchInput = $('#group-search');
groupSearchInput.autocomplete({ groupSearchInput.autocomplete({
source: availableGroups source: availableGroups
});
}); });
});
$('#group-search').on('keypress', function(e) { $('#group-search').on('keypress', function(e) {
if (e.which == 13) { if (e.which === 13) {
e.preventDefault(); e.preventDefault();
$('#search-form').submit(); $('#search-form').submit();
} }
}); });
</script> </script>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>

View File

@@ -29,125 +29,127 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php $answers = Invoke_Infra("select * from cmdb_vms where cluster not like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?> <?php $answers = Invoke_Infra("select * from cmdb_vms where cluster not like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h2><span class="badge text-bg-secondary " style="width:100%;" >Legacy Hyper-V VM List - <?php echo count($answers); ?> VMs</span></h2> <h2><span class="badge text-bg-secondary " style="width:100%;" >Legacy Hyper-V VM List - <?php echo count($answers); ?> VMs</span></h2>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- TABLE --> <!-- TABLE -->
<div> <div>
<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"> <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 --> <thead> <!-- Header -->
<tr>
<th data-field='vm' data-sortable='true'>VM</th> <th data-field='vm' data-sortable='true'>VM</th>
<th data-field='owner' data-sortable='true'>Owner</th> <th data-field='owner' data-sortable='true'>Owner</th>
<th data-field='infos' data-sortable='true'>Infos</th> <th data-field='infos' data-sortable='true'>Infos</th>
<th data-field='PreferedOwner' data-sortable='true'>Prefered Owner</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='gen-ver' data-sortable='true'>Gen & Version</th>
<th data-field='LastInventory' data-sortable='true'>Last Seen</th> <th data-field='LastInventory' data-sortable='true'>Last Seen</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
<?php <?php
foreach ($answers as $row) { foreach ($answers as $row) {
echo "<tr>"; echo "<tr>";
# Name # Name
$state = '<i class="bi bi-question-square-fill text-primary"></i> '; $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'] == "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'] == "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> ';} if($row['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
echo "<td>".$state." <b>".$row['Name']."</td>"; echo "<td>".$state." <b>".$row['Name']."</td>";
# Owner # Owner
echo "<td>".$row['Owner']."</td>"; echo "<td>".$row['Owner']."</td>";
# Infos # Infos
echo '<td><span class="badge rounded-pill bg-secondary text-light">'.$row['Memory'].'GB / '.$row['CPU'].' CPU</span> '; 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> '; echo '<span class="badge rounded-pill bg-secondary text-light">VHDx(s) : '.$row['TotalDiskSize'].' GB</span> ';
if($row['WWPNs'] != ""){ if($row['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> '; 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']){
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>";
} }
?> 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']){
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> </tbody>
</table> </table>
<br> <br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
$(function() { $(function() {
// Exécution initiale pour définir la hauteur // Exécution initiale pour définir la hauteur
adjustTableHeight();
// Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight(); adjustTableHeight();
});
function adjustTableHeight() { // Événement de redimensionnement
var windowHeight = $(window).height(); $(window).on('resize', function() {
var tableTop = $('#t1').offset().top; adjustTableHeight();
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 adjustTableHeight() {
const table = $('#t1');
const windowHeight = $(window).height();
const tableTop = table.offset().top;
const footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
let availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
table.bootstrapTable('refreshOptions', {
height: availableHeight
});
}
});
</script> </script>

View File

@@ -29,124 +29,203 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h2><span class="badge text-bg-secondary " style="width:100%;" >VM Storage (migration phase)</span></h2> <h2><span class="badge text-bg-secondary " style="width:100%;" >VM Storage (migration phase)</span></h2>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- TABLE --> </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="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="vm">
<thead> <!-- Header --> <thead> <!-- Header -->
<tr>
<th data-field='vm' data-sortable='true'>VM</th> <th data-field='vm' data-sortable='true'>VM</th>
<th data-field='Last Backup' data-sortable='true'>Legacy Host</th> <th data-field='Last Backup' data-sortable='true'>Legacy Host</th>
<th data-field='Last Result' data-sortable='true'>Destination Host</th> <th data-field='Last Result' data-sortable='true'>Destination Host</th>
<th data-field='Last Good' data-sortable='true'>VHDX Storage</th> <th data-field='Last Good' data-sortable='true'>VHDX Storage</th>
<th data-field='Size' data-sortable='true'>VNX Luns</th> <th data-field='Size' data-sortable='true'>VNX Luns</th>
<th data-field='Host' data-sortable='true'>SVC Luns</th> <th data-field='Host' data-sortable='true'>SVC Luns</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
<?php <tbody> <!-- Body -->
$answers = Invoke_Infra("SELECT * FROM cmdb_vms where (owner like '%DUN%' or owner like '%mdk%') and owner not like '%VMH-WM%' and owner not like '%WKG%' and DecomTime is null order by name"); <?php
$clusters = Invoke_WebInfraTools("select distinct hostname from storage_lun where hostname like '%-c1%'"); // --- STEP 1: DATA FETCHING ---
$lunsVNX = Invoke_WebInfraTools("select * from storage_lun where baie = 'VNX'"); // Fetch all necessary data with the minimum number of queries.
$lunsSVC = Invoke_WebInfraTools("select * from storage_lun where baie = 'SVC'");
foreach ($answers as $row) {
echo "<tr>";
echo "<td>".$row['Name']."</td>";
if(strpos($row['Owner'],"SYN") !== false || strpos($row['Owner'],"MIG") !== false){
echo "<td></td><td>".$row['Owner']."</td>";
}else{
echo "<td>".$row['Owner']."</td><td></td>";
}
echo "<td>".str_replace(".vhdx,"," : ",str_replace("|","GB<br>",$row['VHDXs']))."GB</td>";
if($row['WWPNs'] != ""){
echo "<td>";
foreach($lunsVNX as $lun){
if($lun['hostname'] == $row['Name']){
echo explode("_",$lun['name'])[1]." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
echo "<td>";
foreach($lunsSVC as $lun){
if($lun['hostname'] == $row['Name']){
echo $lun['name']." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
}else{echo "<td></td><td></td>";} // Fetch all VMs
echo "</tr>"; $vms = Invoke_Infra("SELECT Name, Owner, VHDXs, WWPNs FROM cmdb_vms WHERE (owner LIKE '%DUN%' OR owner LIKE '%mdk%') AND owner NOT LIKE '%VMH-WM%' AND owner NOT LIKE '%WKG%' AND DecomTime IS NULL ORDER BY name");
// Fetch all relevant LUNs (both VNX and SVC) in a SINGLE query.
// This is much more efficient than fetching them separately and then querying again in a loop.
$all_luns = Invoke_WebInfraTools("SELECT hostname, baie, name, size FROM storage_lun WHERE baie IN ('VNX', 'SVC')");
// --- STEP 2: DATA PROCESSING ---
// Organize the LUNs into an associative array for very fast lookups.
// The key will be the hostname, and the value will be an array of its LUNs.
$luns_by_hostname = [];
foreach ($all_luns as $lun) {
$hostname = $lun['hostname'];
// Initialize the array for this hostname if it's the first time we see it.
if (!isset($luns_by_hostname[$hostname])) {
$luns_by_hostname[$hostname] = [
'VNX' => [],
'SVC' => []
];
} }
foreach ($clusters as $row) { // Add the LUN to the correct category (VNX or SVC) for its host.
$lunsVNX = Invoke_WebInfraTools("select * from storage_lun where baie = 'VNX' and hostname = '".$row['hostname']."' order by name"); $luns_by_hostname[$hostname][$lun['baie']][] = $lun;
$lunsSVC = Invoke_WebInfraTools("select * from storage_lun where baie = 'SVC' and hostname = '".$row['hostname']."' order by name"); }
echo "<tr>";
echo "<td>".$row['hostname']." (Cluster)</td>"; // Get the list of cluster hostnames from the LUNs we already fetched.
echo "<td></td><td></td><td></td>"; // This avoids an extra database query for clusters.
echo "<td>"; $cluster_hostnames = [];
foreach($lunsVNX as $lun){ foreach ($luns_by_hostname as $hostname => $luns) {
if($lun['hostname'] == $row['hostname']){ if (str_contains($hostname, '-c1')) {
echo explode("_",$lun['name'])[1]." : ".$lun['size']."GB<br>\n"; $cluster_hostnames[] = $hostname;
} }
} }
echo "</td>"; sort($cluster_hostnames); // Sort them alphabetically
echo "<td>";
foreach($lunsSVC as $lun){
if($lun['hostname'] == $row['hostname']){ // --- STEP 3: RENDERING ---
echo $lun['name']." : ".$lun['size']."GB<br>\n"; // Now, loop through the prepared data and render the HTML.
} // Use htmlspecialchars() on all output to prevent XSS attacks.
}
echo "</td>"; /**
* Helper function to render LUNs for a specific host, avoiding duplicates.
* This avoids code duplication and handles redundant data from the DB.
* @param array $luns The array of LUNs for a specific host.
* @param string $type 'VNX' or 'SVC'.
* @return string The generated HTML for the table cell.
*/
function renderLuns(array $luns, string $type): string {
$html = "<td>";
$rendered_luns = []; // Array to track what has been rendered
if (!empty($luns)) {
foreach ($luns as $lun) {
$lun_name = ($type === 'VNX' && str_contains($lun['name'], '_')) ? explode("_", $lun['name'])[1] : $lun['name'];
$lun_size = $lun['size'];
// Create a unique key for this LUN to detect duplicates
$unique_key = $lun_name . ':' . $lun_size;
// If we have already rendered this exact LUN, skip it
if (in_array($unique_key, $rendered_luns)) {
continue;
}
// Render the LUN and add its key to our tracking array
$html .= htmlspecialchars($lun_name) . " : " . htmlspecialchars($lun_size) . "GB<br>\n";
$rendered_luns[] = $unique_key;
} }
echo "</tr>"; }
?> $html .= "</td>";
</tbody> return $html;
</table> }
<br>
</div> // Render rows for VMs
foreach ($vms as $vm) {
echo "<tr>";
echo "<td>" . htmlspecialchars($vm['Name']) . "</td>";
if (str_contains($vm['Owner'], "SYN") || str_contains($vm['Owner'], "MIG")) {
echo "<td></td><td>" . htmlspecialchars($vm['Owner']) . "</td>";
} else {
echo "<td>" . htmlspecialchars($vm['Owner']) . "</td><td></td>";
}
// --- CORRECTED VHDX RENDERING ---
$vhdx_parts = [];
if (!empty($vm['VHDXs'])) {
// 1. Split the string into an array of individual VHDX entries
$vhdx_entries = explode('|', $vm['VHDXs']);
foreach ($vhdx_entries as $entry) {
// 2. Replace the first comma (after .vhdx) with " : " and add "GB"
// The limit parameter '2' ensures we only replace the first occurrence.
$formatted_entry = preg_replace('/\.vhdx,/', ' : ', $entry, 1) . 'GB';
$vhdx_parts[] = $formatted_entry;
}
}
// 3. Join all formatted parts with a comma and a space
echo "<td>" . implode('<br>', $vhdx_parts) . "</td>";
if ($vm['WWPNs'] != "") {
$hostname = $vm['Name'];
$vnx_luns = $luns_by_hostname[$hostname]['VNX'] ?? [];
$svc_luns = $luns_by_hostname[$hostname]['SVC'] ?? [];
echo renderLuns($vnx_luns, 'VNX');
echo renderLuns($svc_luns, 'SVC');
} else {
echo "<td></td><td></td>";
}
echo "</tr>";
}
// Render rows for Clusters
foreach ($cluster_hostnames as $hostname) {
echo "<tr>";
echo "<td>" . htmlspecialchars($hostname) . " (Cluster)</td>";
echo "<td></td><td></td><td></td>"; // Empty cells for Legacy, Destination, VHDX
$vnx_luns = $luns_by_hostname[$hostname]['VNX'] ?? [];
$svc_luns = $luns_by_hostname[$hostname]['SVC'] ?? [];
echo renderLuns($vnx_luns, 'VNX');
echo renderLuns($svc_luns, 'SVC');
echo "</tr>";
}
?>
</tbody>
</tbody>
</table>
<br>
</div> </div>
<!-- End of main content -->
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
const table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -154,19 +233,15 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); const options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); const options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
document.getElementById("ERR").innerHTML = "<?php echo $ERR ; ?>";
</script> </script>

View File

@@ -29,155 +29,157 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php $answers = Invoke_Infra("select * from cmdb_vms where cluster like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?> <?php $answers = Invoke_Infra("select * from cmdb_vms where cluster like 'DMV-VMH-SYN%' and decomtime is null order by name"); ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h2><span class="badge text-bg-secondary " style="width:100%;" >Synergy VM List - <?php echo count($answers); ?> VMs</span></h2> <h2><span class="badge text-bg-secondary " style="width:100%;" >Synergy VM List - <?php echo count($answers); ?> VMs</span></h2>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- TABLE --> </div>
<div> <!-- TABLE -->
<div id="result" class="text-center"></div> <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"> <table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="vm">
<thead> <!-- Header --> <thead> <!-- Header -->
<tr>
<th data-field='vm' data-sortable='true'>VM</th> <th data-field='vm' data-sortable='true'>VM</th>
<th data-field='owner' data-sortable='true'>Owner</th> <th data-field='owner' data-sortable='true'>Owner</th>
<th data-field='infos' data-sortable='true'>Infos</th> <th data-field='infos' data-sortable='true'>Infos</th>
<th data-field='PreferedOwner' data-sortable='true'>Prefered Owner</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='gen-ver' data-sortable='true'>Gen & Version</th>
<th data-field='LastInventory' data-sortable='true'>Last Seen</th> <th data-field='LastInventory' data-sortable='true'>Last Seen</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
<?php <?php
$wrongOwner = $unclustered = $v10 = 0 ; $msg ="" ; $CpuComp = 0; $DynVHD = 0; $wrongOwner = $unclustered = $v10 = 0 ; $msg ="" ; $CpuComp = 0; $DynVHD = 0;
foreach ($answers as $row) { foreach ($answers as $row) {
echo "<tr>"; echo "<tr>";
# Name # Name
$state = '<i class="bi bi-question-square-fill text-primary"></i> '; $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'] == "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'] == "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> ';} if($row['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
echo "<td>".$state." <b>".$row['Name']."</td>"; echo "<td>".$state." <b>".$row['Name']."</td>";
# Owner # Owner
echo "<td>".$row['Owner']."</td>"; echo "<td>".$row['Owner']."</td>";
# Infos # Infos
echo '<td><span class="badge rounded-pill bg-secondary text-light">'.$row['Memory'].'GB / '.$row['CPU'].' CPU</span> '; 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> '; echo '<span class="badge rounded-pill bg-secondary text-light">VHDx(s) : '.$row['TotalDiskSize'].' GB</span> ';
if($row['WWPNs'] != ""){ if($row['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> '; 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++;
}
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']){
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($row['CPUcomp'] == "True"){
if($unclustered > 0){$msg .= "&nbsp;<span class='badge bg-danger'>$unclustered VM(s) Unclustered</span>";} echo '<span class="badge rounded-pill bg-warning text-dark">CPU Comp.</span> '; $CpuComp++;
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($row['DynamicVHD'] == "Y"){
if($DynVHD > 0){$msg .= "&nbsp;<span class='badge bg-secondary text-warning'>$DynVHD VM(s) With Dynamic VHDx</span>";} echo '<span class="badge rounded-pill bg-secondary text-warning">Dyn. VHDX</span> '; $DynVHD++;
?> }
</tbody> echo "</td>";
</table> # Prefered Owner
<br> if($row['Owner'] == $row['PreferredOwner']){
</div> 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>";}
if($DynVHD > 0){$msg .= "&nbsp;<span class='badge bg-secondary text-warning'>$DynVHD VM(s) With Dynamic VHDx</span>";}
?>
</tbody>
</table>
<br>
</div> </div>
<!-- End of main content -->
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
$(function() { $(function() {
// Exécution initiale pour définir la hauteur const table = $('#t1');
adjustTableHeight(); // Exécution initiale pour définir la hauteur
// Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight(); adjustTableHeight();
});
function adjustTableHeight() { // Événement de redimensionnement
var windowHeight = $(window).height(); $(window).on('resize', function() {
var tableTop = $('#t1').offset().top; adjustTableHeight();
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 adjustTableHeight() {
const windowHeight = $(window).height();
const tableTop = table.offset().top;
const footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
let availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
table.bootstrapTable('refreshOptions', {
height: availableHeight
});
}
});
document.getElementById("result").innerHTML = "<?php echo "<h4>".$msg."</h4>" ; ?>"; document.getElementById("result").innerHTML = "<?php echo "<h4>".$msg."</h4>" ; ?>";

View File

@@ -30,10 +30,6 @@
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA
//$answers = Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and Exclusion ='' and LastResult <> 'OK' order by lastresult,name");
//$answers += Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and Exclusion <>'' order by name");
?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
@@ -54,8 +50,8 @@
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@@ -70,6 +66,7 @@
<div> <div>
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM"> <table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM">
<thead> <!-- Header --> <thead> <!-- Header -->
<tr>
<th data-field='vm' data-sortable='true'>VM</th> <th data-field='vm' data-sortable='true'>VM</th>
<th data-field='Last Backup' data-sortable='true'>Last Backup</th> <th data-field='Last Backup' data-sortable='true'>Last Backup</th>
<th data-field='Last Result' data-sortable='true'>Last Result</th> <th data-field='Last Result' data-sortable='true'>Last Result</th>
@@ -77,6 +74,7 @@
<th data-field='Size' data-sortable='true'>Size</th> <th data-field='Size' data-sortable='true'>Size</th>
<th data-field='Host' data-sortable='true'>Host</th> <th data-field='Host' data-sortable='true'>Host</th>
<th data-field='Policy' data-sortable='true' data-visible='false'>Policy</th> <th data-field='Policy' data-sortable='true' data-visible='false'>Policy</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
@@ -219,28 +217,31 @@
</HTML> </HTML>
<SCRIPT> <SCRIPT>
$(document).ready(function() { $(function() {
$('#t1').DataTable({ // Exécution initiale pour définir la hauteur
scrollY: '50vh', adjustTableHeight();
scrollCollapse: true,
paging: false, // Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight();
}); });
function adjustTableHeight() {
const table = $('#t1');
const windowHeight = $(window).height();
const tableTop = table.offset().top;
const footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
let availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
table.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 ; ?>"; document.getElementById("ERR").innerHTML = "<?php echo $ERR ; ?>";
</script> </script>

View File

@@ -1,246 +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 // DATA
//$answers = Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and Exclusion ='' and LastResult <> 'OK' order by lastresult,name");
//$answers += Invoke_infra("SELECT * FROM VMs_Backup where Owner like 'DUN-VMH%' and name not like 'WS%' and owner not like '%WKG%' and Exclusion <>'' order by name");
?>
<!-- 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%;" id="ERR"></span></h2>
<!-- Main content -->
<div class="container-fluid">
<!-- MODAL WAIT -->
<div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="padding-top: 15%;">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center>
</h4>
</div>
<div class="modal-body">
<div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- TABLE -->
<div>
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM">
<thead> <!-- Header -->
<th data-field='vm' data-sortable='true'>VM</th>
<th data-field='Last Backup' data-sortable='true'>Last Backup</th>
<th data-field='Last Result' data-sortable='true'>Last Result</th>
<th data-field='Last Good' data-sortable='true'>Last Good Backup</th>
<th data-field='Size' data-sortable='true'>Size</th>
<th data-field='Host' data-sortable='true'>Host</th>
<th data-field='Policy' data-sortable='true' data-visible='false'>Policy</th>
</thead>
<tbody> <!-- Body -->
<?php
// NO Backup or Backup with Errors
$er = 0;
$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")));
if ($diff->format("%R%a") >= 2 || $row['LastKnownGood'] == ''){
echo "<tr class='table-danger'>";
}else{
echo "<tr class='table-warning'>";
}
if($diff->format("%R%a") == "-0"){$LastGood = "NEVER";}else{$LastGood = $row['LastKnownGood']." (".$diff->format("%R%a")."J)";}
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>".$row['LastBackup']." ".$row['TimeStamp']."</td>";
echo "<td>".$row['LastResult']."</td>";
echo "<td>".$LastGood."</td>";
echo "<td>".$row['LastSize']."</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
}
// Outdated
$outdated = 0;
$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' and TRY_CAST(lastknowngood AS DATE) < CAST(DATEADD(DAY, -2, GETDATE()) AS DATE) order by name");
foreach ($answers as $row) {
$date1 = date_create($row['LastKnownGood']); $diff = date_diff($date1, date_create(date("Y-m-d")));
if(date('w') >= 2 && date('w') <= 6 ){
if ($diff->format("%R%a") >= 2){
echo "<tr class='table-warning'>";
}else{
echo "<tr class='table-success'>";
}
}else{
if((date('w') < 2 || date('w') == 7)){
if($diff->format("%R%a") <= 3){
echo "<tr class='table-success'>";
}else{
echo "<tr class='table-warning'>";
}
}
}
if($diff->format("%R%a") == "-0"){$LastGood = $row['LastKnownGood'];}else{$LastGood = $row['LastKnownGood']." (".$diff->format("%R%a")."J)";}
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>".$row['LastBackup']." ".$row['TimeStamp']."</td>";
echo "<td>".$row['LastResult']."</td>";
if (date('w') >= 2 && date('w') <= 6 && $diff->format("%R%a") < 1){
echo "<td>".$LastGood."</td>";
}else{
if ((date('w') == 1 || date('w') == 7) && $diff->format("%R%a") <= 3){
echo "<td>".$LastGood."</td>";
}else{
echo "<td class='table-warning'>".$LastGood."</td>";
$outdated++;
}
}
echo "<td>".$row['LastSize']."</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
}
// Backup OK
$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' and TRY_CAST(lastknowngood AS DATE) >= CAST(DATEADD(DAY, -2, GETDATE()) AS DATE) 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 ){
if ($diff->format("%R%a") >= 2){
echo "<tr class='table-warning'>";
}else{
echo "<tr class='table-success'>";
}
}else{
if((date('w') < 2 || date('w') == 7)){
if($diff->format("%R%a") <= 3){
echo "<tr class='table-success'>";
}else{
echo "<tr class='table-warning'>";
}
}
}
if($diff->format("%R%a") == "-0"){$LastGood = $row['LastKnownGood'];}else{$LastGood = $row['LastKnownGood']." (".$diff->format("%R%a")."J)";}
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>".$row['LastBackup']." ".$row['TimeStamp']."</td>";
echo "<td>".$row['LastResult']."</td>";
if (date('w') >= 2 && date('w') <= 6 && $diff->format("%R%a") < 1){
echo "<td>".$LastGood."</td>";
}else{
if ((date('w') == 1 || date('w') == 7) && $diff->format("%R%a") <= 3){
echo "<td>".$LastGood."</td>";
}else{
echo "<td class='table-warning'>".$LastGood."</td>";
$outdated++;
}
}
echo "<td>".$row['LastSize']."</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
}
// Backup OK
$excluded = 0;
$answers = Invoke_infra("SELECT * FROM VMs_Backup where ( Owner like 'DUN-VMH%' 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'>";
echo "<td><b>".$row['Name']."<b></td>";
echo "<td>Tag NoBackup</td>";
echo "<td>Tag NoBackup</td>";
echo "<td>Tag NoBackup</td>";
echo "<td>Tag NoBackup</td>";
echo "<td>".$row['Owner']."</td>";
echo "<td>".$row['Policy']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<?php
$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>
</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

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

View File

@@ -1,209 +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%;"><?php $_GET['cluster']." Details" ; ?></span></h1>
<!-- Main content -->
<?php
$clusters = Invoke_Infra("select * from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."' order by node");
$vmmem = (Invoke_Infra("select sum(cast(vm_memory as int)) as vmem from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."'"))[0]['vmem'];
$clumem = (invoke_infra("select min(node_ram) as nmem from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."'"))[0]['nmem'];
$nb = (invoke_infra("select count(node) as nb from cmdb_HyperV_Hosts where cluster ='".$_GET['cluster']."'"))[0]['nb'];
$clmem = $clumem-32; if($nb == 4){$clmem = $clmem*2;}
?>
<div class="container-fluid" style="zoom:100%">
<h2><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo $_GET['cluster']; ?></span></h2>
<?php
echo "<b>Worst Failover scenario available memory : </b>".($clmem - $vmmem). " / " .$clmem. " GB";
$pcent = round(($clmem - $vmmem)/$clmem*100);
$pcent_restant = 100 - $pcent;
if($pcent <= 5){
$color = "bg-danger"; $border = "red";
}else{
if($pcent <= 10){
$color = "bg-warning"; $border = "yellow";
}else{
$color = "bg-success"; $border = "green";
}
}
echo "
<div class='progress' style='border: 2px solid $border; height: 25px;'>
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width: $pcent_restant%;' aria-valuenow='$pcent_restant' aria-valuemin='0' aria-valuemax='100'></div>
<div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div>
</div>";
echo "<br>";
?>
<div class="row">
<?php
foreach ($clusters as $cluster) {
echo "<div class='col-6'>";
$nbvm = Invoke_Infra("select count(*) as nbvm, sum(memory) as vmmem from cmdb_vms where owner ='".$cluster['node']."' and decomtime is null");
echo '<h3><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">'.$cluster['node']." - ".$nbvm[0]['nbvm']." VMs <small><small> <i class='bi bi-clock'></i> ".$cluster['ts']."</small></small></span></h3><br>";
#Memory
echo "<div class='row'>";
echo "<div class='col'>";
echo "<b>Free Memory : </b>".($cluster['node_ram'] - 32 - $nbvm[0]['vmmem']). " / " .($cluster['node_ram'] - 32). " GB";
$pcent = round(($cluster['node_ram'] - 32 - $nbvm[0]['vmmem'])/($cluster['node_ram'] - 32)*100);
$pcent_restant = 100 - $pcent;
if($pcent <= 5){
$color = "bg-danger";
}else{
if($pcent <= 10){
$color = "bg-warning";
}else{
$color = "bg-success";
}
}
$progress_bar_height = '25px'; // Hauteur de la barre
$marker_overlap = 5; // Dépassement souhaité en px (haut et bas)
$marker_height = (int)$progress_bar_height + (2 * $marker_overlap); // Hauteur totale du marqueur
$marker_top = -$marker_overlap; // Position top du marqueur
echo "</div>";
echo "
<div style='position: relative; display: inline-block;'>
<div class='progress' style='border: 1px solid grey; height: ".$progress_bar_height."; margin-bottom: ".(2 * $marker_overlap)."px;'>
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width:". $pcent_restant ."%;' aria-valuenow='".$pcent_restant."' aria-valuemin='0' aria-valuemax='100'></div>
<div class='progress-bar ".$color."' role='progressbar' style='width: ".$pcent."%;' aria-valuenow='".$pcent."' aria-valuemin='0' aria-valuemax='100'></div>
</div>
<div style='
position: absolute;
left: 50%;
transform: translateX(-50%);
top: ".$marker_top."px;
height: ".$marker_height."px;
width: 2px;
background-color: orange;
z-index: 1;
'></div>
</div>";
echo "</div>" ;
echo "<br>";
#Storage
echo "<div class='row'>";
foreach(explode("|",$cluster['csvs']) as $csv){
if(strpos($csv,";") != false){
echo "<div class='col'>";
echo "<b>" . explode(";",$csv)[0];
$total = explode(";",$csv)[1]; $used = explode(";",$csv)[2]; $free = $total-$used ;
echo " Free : </b>".$free."/" .$total. " GB";
echo "</div>";
echo "<div class='col'>";
$pcent = round($free/$total*100);
$pcent_restant = 100 - $pcent;
if($pcent <= 10){
$color = "bg-danger";
}else{
if($pcent <= 20){
$color = "bg-warning";
}else{
$color = "bg-success";
}
}
echo "
<div class='progress' style='border: 1px solid grey; height: 25px;'>
<div class='progress-bar bg-dark progress-bar-striped' role='progressbar' style='width: $pcent_restant%;' aria-valuenow='$pcent_restant' aria-valuemin='0' aria-valuemax='100'></div>
<div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div>
</div>";
echo "</div>";
}else{echo "<div class='col'></div><br>";}
}
echo "</div>";
echo "<hr>";
#VMs
$vms = Invoke_Infra("select * from cmdb_vms where owner ='".$cluster['node']."' and decomtime is null order by name");
foreach($vms as $vm){
echo "<div class='row'>";
echo "<div class='col'>";
$state = '<i class="bi bi-question-square-fill text-primary"></i> ';
if($vm['State'] == "Running"){$state = '<i class="bi bi-play-btn-fill text-success"></i> ';}
if($vm['State'] == "Off" || $vm['State'] == "Stopping"){$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';}
if($vm['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';}
if(strpos($vm['Name'],'WS') === 0){
echo $state." <b>".substr($vm['Name'],0,10)."</b>";
}else{
echo $state." <b>".$vm['Name']."</b>";
}
echo "</div>";
echo "<div class='col'>";
echo '<span class="badge rounded-pill bg-secondary text-light">'.$vm['Memory'].'GB / '.$vm['CPU'].' CPU</span> ';
if($vm['WWPNs'] != ""){
echo '<span class="badge rounded-pill bg-primary text-light">LUN(s)</span> ';
}
#echo "</div>";
#echo "<div class='col'>";
if($vm['IsClustered'] != "True"){
echo '<span class="badge rounded-pill bg-danger text-dark"><small>Unclustered</small></span> ';
}else{
if($vm['Owner'] != $vm['PreferredOwner']){
echo '<span class="badge rounded-pill bg-warning text-dark"><small>Wrong Owner</small></span> ';
}
}
echo "</div>";
echo "<div class='col'>";
echo "</div>";
echo "</div>";
}
echo "<br>";
echo "</div>";
}
echo "</div>";
?>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>
<script>
$(".GaugeMeter").gaugeMeter();
</script>

View File

@@ -24,32 +24,32 @@
<script src="/js/chart.min.js"></script> <script src="/js/chart.min.js"></script>
<script src="/js/apexcharts.min.js"></script> <script src="/js/apexcharts.min.js"></script>
<!-- Gauge --> <!-- Gauge -->
<link rel="stylesheet" href="/css/gauge.css"> <link rel="stylesheet" href="/css/Gauge.css">
<script src="/js/jquery.AshAlom.gaugeMeter-2.0.0.min.js"></script> <script src="/js/jquery.AshAlom.gaugeMeter-2.0.0.min.js"></script>
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Database connexion -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?> <!-- Left Navbar -->
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Hyper-V Clusters</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Hyper-V Clusters</span></h1>
<!-- Main content --> <!-- Main content -->
<?php <?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"); $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="container-fluid" style="zoom:90%">
<div class="row"> <div class="row">
<?php <?php
$count = 0; $count = 0;
$totalleft = 0; $totalleft = 0;
foreach ($clusters as $cluster) { foreach ($clusters as $cluster) {
@@ -65,14 +65,15 @@
$vm_mem = 0; $vm_mem = 0;
$disk = 0; $disk = 0;
$io = 0; $io = 0;
$node_mem = 0;
$capacity = 0; $free = 0; $capacity = 0; $free = 0;
foreach ($data as $d) { foreach ($data as $d) {
$vms += $d['vm_count']; $vms += $d['vm_count'];
$vm_mem += $d['vm_memory']; $vm_mem += $d['vm_memory'];
$node_mem = 0 + (int) $d['node_ram']; $node_mem = (int) $d['node_ram'];
foreach (explode("|", $d['csvs']) as $csv) { foreach (explode("|", $d['csvs']) as $csv) {
if (instr($csv, ';')) { if (instr($csv, ';')) {
$free += explode(";", $csv)[1] - explode(";", $csv)[2]; $free += intval(explode(";", $csv)[1]) - intval(explode(";", $csv)[2]);
$disk = max($disk, $free); $disk = max($disk, $free);
$capacity += (int) explode(";", $csv)[1]; $capacity += (int) explode(";", $csv)[1];
} }
@@ -97,30 +98,30 @@
?> ?>
<div class='col-3'> <div class='col-3'>
<a href="Cluster-detail.php?cluster=<?php echo $cluster['cluster']; ?>" class="text-decoration-none" target="_blank"> <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 border-secondary mb-3'>
<div class='card-header text-white bg-dark border-secondary'> <div class='card-header text-white bg-dark border-secondary'>
<h4> <h4 class="text-center">
<center><?php echo $cluster['cluster']; ?></center> <?php echo $cluster['cluster']; ?>
</h4> </h4>
<h6> <h6 class="text-center">
<center><b><?php echo $nodes; ?></b> Nodes / <b><?php echo $vms; ?></b> VMs <?php echo $vleft; ?></center> <b><?php echo $nodes; ?></b> Nodes / <b><?php echo $vms; ?></b> VMs <?php echo $vleft; ?>
</h6> </h6>
<?php <?php
if((int)$nodes == 2 && $vms > 0){ if($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"); $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; $vmCountNode1 = $vmCountNode2 = 0;
$node1_name = $node2_name = ""; $node1_name = $node2_name = "";
if(count($Repart) == 1 ){ if(count($Repart) == 1 ){
$node1_name = $Repart[0]['Owner']; $vmCountNode1 = $Repart[0]['nbvm']; $node1_name = $Repart[0]['Owner']; $vmCountNode1 = $Repart[0]['nbvm'];
}else{ }else{
$node1_name = 'DUN'; $vmCountNode1 = $Repart[0]['nbvm']; $node1_name = 'DUN'; $vmCountNode1 = $Repart[0]['nbvm'];
$node2_name = 'MDK'; $vmCountNode2 = $Repart[1]['nbvm']; $node2_name = 'MDK'; $vmCountNode2 = $Repart[1]['nbvm'];
} }
$totalVMs = $vmCountNode1 + $vmCountNode2; $totalVMs = $vmCountNode1 + $vmCountNode2;
$percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0; $percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0;
$percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0; $percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0;
echo "<div class='progress' style='border: 2px solid grey; height: 20px;'> 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'> <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> <b>$node1_name : $vmCountNode1 VMs</b>
</div> </div>
@@ -128,16 +129,16 @@
<b>$node2_name : $vmCountNode2 VMs</b> <b>$node2_name : $vmCountNode2 VMs</b>
</div> </div>
</div>"; </div>";
}elseif((int)$nodes == 4){ }elseif($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"); $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"); $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; $vmCountNode1 = $vmCountNode2 = 0;
$node1_name = 'DUN'; $vmCountNode1 = $RepartD[0]['nbvm']; $node1_name = 'DUN'; $vmCountNode1 = $RepartD[0]['nbvm'];
$node2_name = 'MDK'; $vmCountNode2 = $RepartM[0]['nbvm']; $node2_name = 'MDK'; $vmCountNode2 = $RepartM[0]['nbvm'];
$totalVMs = $vmCountNode1 + $vmCountNode2; $totalVMs = $vmCountNode1 + $vmCountNode2;
$percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0; $percentageNode1 = ($totalVMs > 0) ? ($vmCountNode1 / $totalVMs) * 100 : 0;
$percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0; $percentageNode2 = ($totalVMs > 0) ? ($vmCountNode2 / $totalVMs) * 100 : 0;
echo "<div class='progress' style='border: 2px solid grey; height: 20px;'> 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'> <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> <b>$node1_name : $vmCountNode1 VMs</b>
</div> </div>
@@ -146,17 +147,17 @@
</div> </div>
</div>"; </div>";
}else{ }else{
echo "<div class='progress' style='border: 2px solid grey; height: 20px; background-Color: transparent;'> 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 class='progress-bar' style='width: 0; background-color: transparent;'></div>
</div>"; </div>";
} }
?> ?>
</div> </div>
<div class='card-body text-white bg-dark'> <div class='card-body text-white bg-dark'>
<?php <?php
//Memory //Memory
echo "<div class='row'>"; echo "<div class='row'>";
echo "<div class='col-7'>"; echo "<div class='col-7'>";
echo "<b>Free Mem : </b>".($clmem - $vm_mem). " / " .$clmem. " GB"; echo "<b>Free Mem : </b>".($clmem - $vm_mem). " / " .$clmem. " GB";
echo "</div><div class='col-5'>"; echo "</div><div class='col-5'>";
@@ -176,9 +177,9 @@
<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 bg-dark progress-bar-striped' role='progressbar' style='width: $pcent_restant%;' aria-valuenow='$pcent_restant' aria-valuemin='0' aria-valuemax='100'></div>
<div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div> <div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div>
</div>"; </div>";
echo "</div></div>"; echo "</div></div>";
//DISK //DISK
echo "<div class='row'>"; echo "<div class='row'>";
echo "<div class='col-7'>"; echo "<div class='col-7'>";
$unit="GB"; $unit="GB";
if($capacity > 10000){ if($capacity > 10000){
@@ -188,7 +189,7 @@
$used = $capacity - $free; $used = $capacity - $free;
echo "<b>Free CSV : </b>".$free. " / " .$capacity. " $unit"; echo "<b>Free CSV : </b>".$free. " / " .$capacity. " $unit";
echo "</div><div class='col-5'>"; echo "</div><div class='col-5'>";
$pcent = round(($free)/$capacity*100); $pcent = ($clmem > 0) ? round(($clmem - $vm_mem) / $clmem * 100) : 0;
$pcent_restant = 100 - $pcent; $pcent_restant = 100 - $pcent;
if($pcent <= 5){ if($pcent <= 5){
$color = "bg-danger"; $border = "red"; $color = "bg-danger"; $border = "red";
@@ -204,28 +205,25 @@
<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 bg-dark progress-bar-striped' role='progressbar' style='width: $pcent_restant%;' aria-valuenow='$pcent_restant' aria-valuemin='0' aria-valuemax='100'></div>
<div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div> <div class='progress-bar $color' role='progressbar' style='width: $pcent%;' aria-valuenow='$pcent' aria-valuemin='0' aria-valuemax='100'></div>
</div>"; </div>";
echo "</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>"; 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> </div>
</div>
</a> </a>
</div> </div>
<?php <?php
$count++; } $count++; }
?> ?>
<br><br><h3><center>Total VM Left : <?php echo $totalleft;?> </center></h3> <br><br><h3 class ="text-center">Total VM Left : <?php echo $totalleft;?> </h3>
</div>
<!-- End of main content -->
</div>
</div> </div>
<!-- End of main content --> </div>
</div> <script src="/js/switch.js"></script>
</div>
</div>
<script src="/js/switch.js"></script>
</body> </body>
<script> <script>

View File

@@ -32,10 +32,6 @@
animation: blink 1.2s infinite; animation: blink 1.2s infinite;
} }
</style> </style>
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
@@ -95,7 +91,10 @@
echo "</div></div></body></HTML>"; echo "</div></div></body></HTML>";
exit; exit;
} }
if(strpos($Qw[0]['DECOM'], '-') || strpos($Qx[0]['Decom'], '-')){
$isDecomInQw = is_array($Qw) && !empty($Qw[0]['DECOM']) && str_contains($Qw[0]['DECOM'], '-');
$isDecomInQx = is_array($Qx) && !empty($Qx[0]['Decom']) && str_contains($Qx[0]['Decom'], '-');
if($isDecomInQw || $isDecomInQx){
echo '<h1><span class="badge text-bg-danger font-weight-bold blinking" style="width:100%;">'. strtoupper($server) .' : DECOMMISSIONED !</span></h1>'; 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 '<script src="/js/switch.js"></script>';
echo "</div></div></body></HTML>"; echo "</div></div></body></HTML>";
@@ -162,27 +161,40 @@
</div> </div>
</div> </div>
</div> </div>
<script src="fillchart2.js"></script> <script src="fillchart.js"></script>
</div> </div>
<!-- Drives --> <!-- Drives -->
<?php <?php
// LUNs ? // LUNs ?
$luns = Invoke_WebInfraTools("select count(*) as lun from storage_lun where hostname = '$server'"); $luns_result = Invoke_WebInfraTools("select count(*) as lun from storage_lun where hostname = '$server'");
if($luns[0]['lun'] >0 || $Qvm[0]['WWPNs'] != ""){ $lun_count = $luns_result[0]['lun'] ?? 0;
$wwpns = ""; $wwpn_string = $Qvm[0]['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']);} if ($lun_count > 0 || $wwpn_string !== '') {
echo "<div style=\"text-align: center;\"><span class='badge rounded-pill bg-primary text-light fs-5'>" .$luns."</span>"; if ($lun_count > 0) {
if($wwpns != ""){echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>WWPNs :".$wwpns."</span></div><br>";}else{echo "</div><br>";} $luns_display = $lun_count . " LUNs";
} else {
$luns_display = "Some LUNs are owned by cluster";
}
$wwpns_display = str_replace("|", ", ", $wwpn_string);
echo "<div style=\"text-align: center;\">";
echo "<span class='badge rounded-pill bg-primary text-light fs-5'>$luns_display</span>";
if ($wwpns_display !== '') {
echo "&nbsp;<span class='badge rounded-pill bg-secondary text-light fs-5'>WWPNs: $wwpns_display</span>";
}
echo "</div><br>";
} }
?> ?>
<div class="row" id="drives"> <div class="row" id="drives">
<?php <?php
// Drives // Drives
$drives = explode("|",$Qw[0]['drives']); if($OSType == "Windows"){
if($drives[0] === "O"){$drives = explode("|",$Qx[0]['Drives']);} $drives = explode("|",$Qw[0]['drives'] ?? '');
if($drives[0] != "O" && $drives[0] != ""){ }else{
$drives = explode("|",$Qx[0]['Drives'] ?? '');
}
if($drives[0] != ""){
foreach($drives as $drive){ foreach($drives as $drive){
echo "<div class='col-6'><div class='row'>"; echo "<div class='col-6'><div class='row'>";
$data = explode(",",$drive); $data = explode(",",$drive);

View File

@@ -1,13 +1,9 @@
<?php <?php
// Zabbix DB include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ;
$host = 'aztprdzabbix52.armony.net'; $pdo = DB_ZABBIX();
$dbname = 'zabbix';
$user = 'patrick';
$pass = 'showZabbix@dash1';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$server = strtolower($_GET['c']); $server = strtolower($_GET['c']);
$now = time(); $now = time();
$past_24h = $now - 86400; // 24H $past_24h = $now - 86400; // 24H

View File

@@ -1,13 +1,9 @@
<?php <?php
// Zabbix DB include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ;
$host = 'aztprdzabbix52.armony.net'; $pdo = DB_ZABBIX();
$dbname = 'zabbix';
$user = 'patrick';
$pass = 'showZabbix@dash1';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$server = strtolower($_GET['c']); $server = strtolower($_GET['c']);
$now = time(); $now = time();
$past_24h = $now - 86400; // 24H $past_24h = $now - 86400; // 24H

View File

@@ -1,11 +1,6 @@
<?php /** @noinspection PhpIllegalStringOffsetInspection */ <?php
// Zabbix DB include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ;
$host = 'aztprdzabbix52.armony.net'; $pdo = DB_ZABBIX();
$dbname = 'zabbix';
$user = 'patrick';
$pass = 'showZabbix@dash1';
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$server = strtoupper($_GET['c']); $server = strtoupper($_GET['c']);
$now = time(); $now = time();

View File

@@ -1,55 +1,67 @@
let typ = document.getElementById("type").dataset.value; let typ = document.getElementById("type").dataset.value;
let computer = document.getElementById("computer").dataset.value; let computer = document.getElementById("computer").dataset.value;
async function fetchAndDisplayData() { async function fetchAndDisplayData() {
try { try {
const response = await fetch(`z_data_${typ}.php?c=${computer}`); const response = await fetch(`z_data_${typ}.php?c=${computer}`);
const jsonData = await response.json(); const jsonData = await response.json();
const data = jsonData.data || jsonData; const data = jsonData.data || jsonData; // Utilisation plus robuste
const cpuKey = Object.keys(data).find(key => key.includes('CPU')); const cpuKey = Object.keys(data).find(key => key.includes('CPU'));
const ramKey = Object.keys(data).find(key => key.includes('Memory')); const ramKey = Object.keys(data).find(key => key.includes('Memory'));
const labels = [];
// Utilisation d'un Set pour collecter les labels uniques plus efficacement
const uniqueLabels = new Set();
if (cpuKey && data[cpuKey]) { if (cpuKey && data[cpuKey]) {
data[cpuKey].forEach(point => { data[cpuKey].forEach(point => uniqueLabels.add(point.datetime));
if (!labels.includes(point.datetime)) {
labels.push(point.datetime);
}
});
} }
if (ramKey && data[ramKey]) { if (ramKey && data[ramKey]) {
data[ramKey].forEach(point => { data[ramKey].forEach(point => uniqueLabels.add(point.datetime));
if (!labels.includes(point.datetime)) {
labels.push(point.datetime);
}
});
} }
labels.sort(); const labels = Array.from(uniqueLabels).sort(); // Conversion en Array et tri
const cpuDataMap = {};
const ramDataMap = {}; // Fonction pour créer une map de données
if (cpuKey && data[cpuKey]) { const createDataMap = (key, rawData) => {
data[cpuKey].forEach(point => { const map = {};
cpuDataMap[point.datetime] = parseFloat(point.avg_value); if (key && rawData[key]) {
}); rawData[key].forEach(point => {
} map[point.datetime] = parseFloat(point.avg_value);
if (ramKey && data[ramKey]) { });
data[ramKey].forEach(point => { }
ramDataMap[point.datetime] = parseFloat(point.avg_value); return map;
}); };
}
const cpuChartData = labels.map(label => cpuDataMap[label] || null); const cpuDataMap = createDataMap(cpuKey, data);
const ramChartData = labels.map(label => ramDataMap[label] || null); const ramDataMap = createDataMap(ramKey, data);
// Fonction pour générer les données du graphique
const getChartData = (map, sortedLabels) => sortedLabels.map(label => map[label] ?? null);
const cpuChartData = getChartData(cpuDataMap, labels);
const ramChartData = getChartData(ramDataMap, labels);
// Formatage des labels pour l'axe X
const formattedLabels = labels.map(label => { const formattedLabels = labels.map(label => {
const date = new Date(label); const date = new Date(label);
return date.toLocaleTimeString('fr-FR', {hour: '2-digit', minute: '2-digit'}); return !isNaN(date)
? date.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' })
: 'Invalid Date';
}); });
if (cpuKey && data[cpuKey] && data[cpuKey].length > 0) {
const ctx1 = document.getElementById('cpuChart').getContext('2d'); // *** Fonction pour créer un graphique (adaptée pour v2.x) ***
new Chart(ctx1, { const createChartV2 = (canvasId, label, chartData, formattedLabels) => {
const ctx = document.getElementById(canvasId)?.getContext('2d');
if (!ctx) {
console.error(`Canvas element with id "${canvasId}" not found.`);
return null;
}
return new Chart(ctx, {
type: 'line', type: 'line',
data: { data: {
labels: formattedLabels, labels: formattedLabels,
datasets: [{ datasets: [{
label: 'CPU (%)', label: label, // Garde le label pour l'infobulle
data: cpuChartData, data: chartData,
borderColor: 'rgb(54, 162, 235)', borderColor: 'rgb(54, 162, 235)',
backgroundColor: 'rgba(54, 162, 235, 0.1)', backgroundColor: 'rgba(54, 162, 235, 0.1)',
fill: true, fill: true,
@@ -58,40 +70,69 @@ async function fetchAndDisplayData() {
}] }]
}, },
options: { options: {
legend: {display: false}, legend: {
display: false // Cacher la légende en v2
},
responsive: true, responsive: true,
maintainAspectRatio: false, maintainAspectRatio: false,
scales: {y: {beginAtZero: true}} scales: {
yAxes: [{ // *** Utilisation de yAxes (tableau) pour v2.x ***
ticks: {
beginAtZero: true,
// Ajout de la fonction callback pour formater les labels de l'axe Y
callback: function(value, index, values) { // Note: le 3ème argument est 'values' en v2
return value + '%'; // Ajoute le symbole %
}
// max: 100, // Optionnel mais recommandé pour les pourcentages
// stepSize: 5 // Optionnel: pour suggérer un intervalle
}
// scaleLabel: { // Si vous vouliez un titre d'axe en v2 (ce que vous ne voulez pas)
// display: false,
// labelString: 'Utilisation (%)'
// }
}],
xAxes: [{ // *** xAxes doit aussi être dans un tableau en v2.x ***
// ... autres options pour l'axe X si nécessaire ...
}]
},
tooltips: { // *** 'tooltips' au pluriel en v2.x ***
callbacks: {
label: function(tooltipItem, data) { // Arguments différents en v2
let label = data.datasets[tooltipItem.datasetIndex].label || '';
if (label) {
label += ': ';
}
// tooltipItem.yLabel contient la valeur numérique en v2
if (tooltipItem.yLabel !== null && typeof tooltipItem.yLabel !== 'undefined') {
label += tooltipItem.yLabel + '%';
}
return label;
}
}
}
} }
}); });
};
// Création des graphiques en utilisant la fonction adaptée pour v2.x
if (cpuKey && data[cpuKey]?.length > 0) {
createChartV2('cpuChart', 'CPU (%)', cpuChartData, formattedLabels);
} else {
const cpuChartElement = document.getElementById('cpuChart');
if (cpuChartElement) cpuChartElement.style.display = 'none';
console.log("Pas de données CPU à afficher.");
} }
if (ramKey && data[ramKey] && data[ramKey].length > 0) {
const ctx2 = document.getElementById('ramChart').getContext('2d'); if (ramKey && data[ramKey]?.length > 0) {
new Chart(ctx2, { createChartV2('ramChart', 'Memory (%)', ramChartData, formattedLabels);
type: 'line', } else {
data: { const ramChartElement = document.getElementById('ramChart');
labels: formattedLabels, if (ramChartElement) ramChartElement.style.display = 'none';
datasets: [{ console.log("Pas de données RAM à afficher.");
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) { } catch (error) {
console.error('Erreur:', error); console.error('Erreur lors de la récupération ou de l\'affichage des données:', error);
} }
} }

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

@@ -1,139 +0,0 @@
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; // Utilisation plus robuste
const cpuKey = Object.keys(data).find(key => key.includes('CPU'));
const ramKey = Object.keys(data).find(key => key.includes('Memory'));
// Utilisation d'un Set pour collecter les labels uniques plus efficacement
const uniqueLabels = new Set();
if (cpuKey && data[cpuKey]) {
data[cpuKey].forEach(point => uniqueLabels.add(point.datetime));
}
if (ramKey && data[ramKey]) {
data[ramKey].forEach(point => uniqueLabels.add(point.datetime));
}
const labels = Array.from(uniqueLabels).sort(); // Conversion en Array et tri
// Fonction pour créer une map de données
const createDataMap = (key, rawData) => {
const map = {};
if (key && rawData[key]) {
rawData[key].forEach(point => {
map[point.datetime] = parseFloat(point.avg_value);
});
}
return map;
};
const cpuDataMap = createDataMap(cpuKey, data);
const ramDataMap = createDataMap(ramKey, data);
// Fonction pour générer les données du graphique
const getChartData = (map, sortedLabels) => sortedLabels.map(label => map[label] ?? null);
const cpuChartData = getChartData(cpuDataMap, labels);
const ramChartData = getChartData(ramDataMap, labels);
// Formatage des labels pour l'axe X
const formattedLabels = labels.map(label => {
const date = new Date(label);
return !isNaN(date)
? date.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' })
: 'Invalid Date';
});
// *** Fonction pour créer un graphique (adaptée pour v2.x) ***
const createChartV2 = (canvasId, label, chartData, formattedLabels) => {
const ctx = document.getElementById(canvasId)?.getContext('2d');
if (!ctx) {
console.error(`Canvas element with id "${canvasId}" not found.`);
return null;
}
return new Chart(ctx, {
type: 'line',
data: {
labels: formattedLabels,
datasets: [{
label: label, // Garde le label pour l'infobulle
data: chartData,
borderColor: 'rgb(54, 162, 235)',
backgroundColor: 'rgba(54, 162, 235, 0.1)',
fill: true,
tension: 0.3,
pointRadius: 0
}]
},
options: {
legend: {
display: false // Cacher la légende en v2
},
responsive: true,
maintainAspectRatio: false,
scales: {
yAxes: [{ // *** Utilisation de yAxes (tableau) pour v2.x ***
ticks: {
beginAtZero: true,
// Ajout de la fonction callback pour formater les labels de l'axe Y
callback: function(value, index, values) { // Note: le 3ème argument est 'values' en v2
return value + '%'; // Ajoute le symbole %
}
// max: 100, // Optionnel mais recommandé pour les pourcentages
// stepSize: 5 // Optionnel: pour suggérer un intervalle
}
// scaleLabel: { // Si vous vouliez un titre d'axe en v2 (ce que vous ne voulez pas)
// display: false,
// labelString: 'Utilisation (%)'
// }
}],
xAxes: [{ // *** xAxes doit aussi être dans un tableau en v2.x ***
// ... autres options pour l'axe X si nécessaire ...
}]
},
tooltips: { // *** 'tooltips' au pluriel en v2.x ***
callbacks: {
label: function(tooltipItem, data) { // Arguments différents en v2
let label = data.datasets[tooltipItem.datasetIndex].label || '';
if (label) {
label += ': ';
}
// tooltipItem.yLabel contient la valeur numérique en v2
if (tooltipItem.yLabel !== null && typeof tooltipItem.yLabel !== 'undefined') {
label += tooltipItem.yLabel + '%';
}
return label;
}
}
}
}
});
};
// Création des graphiques en utilisant la fonction adaptée pour v2.x
if (cpuKey && data[cpuKey]?.length > 0) {
createChartV2('cpuChart', 'CPU (%)', cpuChartData, formattedLabels);
} else {
const cpuChartElement = document.getElementById('cpuChart');
if (cpuChartElement) cpuChartElement.style.display = 'none';
console.log("Pas de données CPU à afficher.");
}
if (ramKey && data[ramKey]?.length > 0) {
createChartV2('ramChart', 'Memory (%)', ramChartData, formattedLabels);
} else {
const ramChartElement = document.getElementById('ramChart');
if (ramChartElement) ramChartElement.style.display = 'none';
console.log("Pas de données RAM à afficher.");
}
} catch (error) {
console.error('Erreur lors de la récupération ou de l\'affichage des données:', error);
}
}
window.addEventListener('load', fetchAndDisplayData);

View File

@@ -1,14 +1,10 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.inc.php" ; include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ;
if (isset($_GET['term'])) { if (isset($_GET['term'])) {
$term = $_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%'"; $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"; $conn = DB_INFRA();
$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); $rs = odbc_exec($conn, $query);
while ($row = odbc_fetch_array($rs)) { while ($row = odbc_fetch_array($rs)) {
$servers[] = $row; $servers[] = $row;

View File

@@ -29,9 +29,9 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$answers = Invoke_GLPI("SELECT a.name as server,left(d.name,4) as 'type', $answers = Invoke_GLPI("SELECT a.name as server,left(d.name,4) as 'type',
b.arretprogrammezeroonefield as january, b.arretprogrammezeroonefield as january,
b.arretprogrammezerotwofield as february, b.arretprogrammezerotwofield as february,
b.arretprogrammezerothreefield as march, b.arretprogrammezerothreefield as march,
@@ -50,96 +50,99 @@
left join glpi_plugin_fields_typearretfielddropdowns d on d.id = c.plugin_fields_typearretfielddropdowns_id left join glpi_plugin_fields_typearretfielddropdowns d on d.id = c.plugin_fields_typearretfielddropdowns_id
where a.entities_id = 6 and a.name is not null and d.name is not null and b.arretprogrammezeroonefield is not null where a.entities_id = 6 and a.name is not null and d.name is not null and b.arretprogrammezeroonefield is not null
order by Server asc"); order by Server asc");
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Rollup Calendar</h6></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Rollup Calendar</h6></span></h1>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- TABLE -->
<div style="zoom:80%">
<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="Server" data-sortable="true">Server</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="January" data-sortable="true">January</th>
<th data-field="February" data-sortable="true">February</th>
<th data-field="March" data-sortable="true">March</th>
<th data-field="April" data-sortable="true">April</th>
<th data-field="May" data-sortable="true">May</th>
<th data-field="June" data-sortable="true">June</th>
<th data-field="July" data-sortable="true">July</th>
<th data-field="August" data-sortable="true">August</th>
<th data-field="September" data-sortable="true">September</th>
<th data-field="October" data-sortable="true">October</th>
<th data-field="November" data-sortable="true">November</th>
<th data-field="December" data-sortable="true">December</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $answer) {
echo "<td class='text-nowrap'><b>".$answer['server']."</b></td>";
echo "<td>".$answer['type']."</td>";
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['january']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['february']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['march']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['april']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['may']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['june']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['july']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['august']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['september']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['october']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['november']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['december']."</small></td>")));
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content --> <!-- TABLE -->
<div style="zoom:80%">
<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 -->
<tr>
<th data-field="Server" data-sortable="true">Server</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="January" data-sortable="true">January</th>
<th data-field="February" data-sortable="true">February</th>
<th data-field="March" data-sortable="true">March</th>
<th data-field="April" data-sortable="true">April</th>
<th data-field="May" data-sortable="true">May</th>
<th data-field="June" data-sortable="true">June</th>
<th data-field="July" data-sortable="true">July</th>
<th data-field="August" data-sortable="true">August</th>
<th data-field="September" data-sortable="true">September</th>
<th data-field="October" data-sortable="true">October</th>
<th data-field="November" data-sortable="true">November</th>
<th data-field="December" data-sortable="true">December</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $answer) {
echo "<td class='text-nowrap'><b>".$answer['server']."</b></td>";
echo "<td>".$answer['type']."</td>";
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['january']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['february']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['march']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['april']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['may']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['june']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['july']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['august']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['september']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['october']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['november']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['december']."</small></td>")));
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -147,22 +150,16 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script>
</SCRIPT> </SCRIPT>

View File

@@ -29,98 +29,213 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$folders = Invoke_Infra("select * from fls_and_prs f $folders = Invoke_Infra("select * from fls_and_prs f
left join ad_all_users u on u.cn = f.folder left join ad_all_users u on u.cn = f.folder
where typ = 'HomeDirectory' where typ = 'HomeDirectory'
and (enabled <> 'True' or acl not like 'ARMONY%' or o365 <> 'N') and (enabled <> 'True' or acl not like 'ARMONY%' or o365 <> 'N')
order by [server],folder"); order by [server],folder");
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Home Directories with issues <small><small>(<?php echo count($folders); ?> entries) </small></small><br><h6>Updated every day at 07:00:00</h6></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Home Directories with issues <small><small>(<?php echo count($folders); ?> entries) </small></small></span></h1><h6>Updated every day at 07:00:00</h6>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</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="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="AD" data-sortable="true">in AD</th>
<th data-field="Enabled" data-sortable="true">Account Enabled</th>
<th data-field="o365" data-sortable="true">o365</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="LastLogon" data-sortable="true">Last Logon</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if(instr($answer['acl'],"S-1-5")){$acl="<td class='table-warning'>?</td>";}else{$acl="<td>".$answer['acl']."</td>";}
if($answer['enabled'] != 'True'){$enabled="<td class='table-warning'><b>N</b></td>";}else{$enabled="<td>Y</td>";}
if($answer['cn'] == ''){$inAD="<td class='table-warning'><b>N</b></td>";}else{$inAD="<td>Y</td>";}
if($answer['o365'] != 'N'){$o365="<td class='table-warning'><b>".$answer['o365']."</b></td>";}else{$o365="<td>N</td>";}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo $acl;
echo $inAD;
echo $enabled;
echo $o365;
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td class='text-nowrap'>".$answer['lastlogon']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content --> <!-- 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 -->
<tr>
<th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="AD" data-sortable="true">in AD</th>
<th data-field="Enabled" data-sortable="true">Account Enabled</th>
<th data-field="o365" data-sortable="true">o365</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="LastLogon" data-sortable="true">Last Logon</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if(instr($answer['acl'],"S-1-5")){$acl="<td class='table-warning'>?</td>";}else{$acl="<td>".$answer['acl']."</td>";}
if($answer['enabled'] != 'True'){$enabled="<td class='table-warning'><b>N</b></td>";}else{$enabled="<td>Y</td>";}
if($answer['cn'] == ''){$inAD="<td class='table-warning'><b>N</b></td>";}else{$inAD="<td>Y</td>";}
if($answer['o365'] != 'N'){$o365="<td class='table-warning'><b>".$answer['o365']."</b></td>";}else{$o365="<td>N</td>";}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo $acl;
echo $inAD;
echo $enabled;
echo $o365;
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td class='text-nowrap'>".$answer['lastlogon']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body>
<script src="/js/switch.js"></script>
</HTML>
<!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 // DATA
$folders = Invoke_Infra("SELECT * FROM FLS_and_PRS where typ in('PROJET','TEAMS') order by [server], folder");
?>
<!-- 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%;">Project and Team folders <small><small>(<?php echo count($folders); ?> entries) </small></small></span></h1><h6>Updated every day at 07:00:00</h6>
<!-- 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 text-center">
<i class="bi bi-hourglass-split"></i><br> Work in progress ...
</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 -->
<tr>
<th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if($answer['acl'] == "" || $answer['users'] == 0){
echo "<tr class='table-warning'>";
}else{
echo "<tr>";
}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo "<td>".$answer['typ']."</td>";
echo "<td>".$answer['acl']."</td>";
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td>".$answer['users']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -128,22 +243,16 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script>
</SCRIPT> </SCRIPT>

View File

@@ -29,89 +29,92 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$folders = Invoke_Infra("SELECT * FROM FLS_and_PRS where typ in('PROJET','TEAMS') order by [server], folder"); $folders = Invoke_Infra("SELECT * FROM FLS_and_PRS where typ in('PROJET','TEAMS') order by [server], folder");
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Project and Team folders <small><small>(<?php echo count($folders); ?> entries) </small></small><br><h6>Updated every day at 07:00:00</h6></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Project and Team folders <small><small>(<?php echo count($folders); ?> entries) </small></small></span></h1><h6>Updated every day at 07:00:00</h6>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</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="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if($answer['acl'] == "" || $answer['users'] == 0){
echo "<tr class='table-warning'>";
}else{
echo "<tr>";
}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo "<td>".$answer['typ']."</td>";
echo "<td>".$answer['acl']."</td>";
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td>".$answer['users']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content --> <!-- 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 -->
<tr>
<th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if($answer['acl'] == "" || $answer['users'] == 0){
echo "<tr class='table-warning'>";
}else{
echo "<tr>";
}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo "<td>".$answer['typ']."</td>";
echo "<td>".$answer['acl']."</td>";
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td>".$answer['users']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -119,22 +122,16 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script>
</SCRIPT> </SCRIPT>

View File

@@ -1,194 +0,0 @@
<?php
include $_SERVER['DOCUMENT_ROOT']."/include/all.php";
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php",''),true);
$poolsData = $json['Data']['Pools'];
function formatBytes($bytes, $precision = 2) {
if ($bytes == 0) return '0 octets';
$base = 1024;
$size = $bytes / pow($base, 4);
return round($size, $precision) . ' Tio';
}
$seriesData = [
'V5100' => [
'physical_used' => 0, 'physical_free' => 0, 'physical_total_api' => 0,
'virtual_total' => 0, 'written_total' => 0, 'compressed_total' => 0,
'dedup_savings' => 0
],
'V5030' => [
'physical_used' => 0, 'physical_free' => 0, 'physical_total_api' => 0,
'virtual_total' => 0, 'written_total' => 0, 'compressed_total' => 0,
'dedup_savings' => 0
],
];
foreach ($poolsData as $poolName => $poolDetails) {
$currentSeries = null;
if (strpos($poolName, 'V5100') !== false) {
$currentSeries = 'V5100';
} elseif (strpos($poolName, 'V5030') !== false) {
$currentSeries = 'V5030';
}
if ($currentSeries) {
$used_capacity = (float) $poolDetails['used_capacity'];
$free_capacity = (float) $poolDetails['free_capacity'];
$capacity = (float) $poolDetails['capacity'];
$virtual_cap = (float) $poolDetails['virtual_capacity'];
$uncomp_cap = (float) $poolDetails['compression_uncompressed_capacity'];
$comp_cap = (float) $poolDetails['compression_compressed_capacity'];
$dedup_sav = (float) $poolDetails['deduplication_capacity_saving'];
$seriesData[$currentSeries]['physical_used'] += $used_capacity;
$seriesData[$currentSeries]['physical_free'] += $free_capacity;
$seriesData[$currentSeries]['physical_total_api'] += $capacity;
$seriesData[$currentSeries]['virtual_total'] += $virtual_cap;
$seriesData[$currentSeries]['written_total'] += $uncomp_cap;
$seriesData[$currentSeries]['compressed_total'] += $comp_cap;
$seriesData[$currentSeries]['dedup_savings'] += $dedup_sav;
}
}
foreach ($seriesData as $series => &$data) {
$data['physical_total_calc'] = ($data['physical_used'] + ($data['physical_free'] /2));
$data['physical_used_percent'] = ($data['physical_total_calc'] > 0) ? ($data['physical_used'] / $data['physical_total_calc']) * 100 : 0;
$data['physical_free_percent'] = 100 - $data['physical_used_percent'];
$data['volume_written_percent'] = ($data['virtual_total'] > 0) ? ($data['written_total'] / $data['virtual_total']) * 100 : 0;
$data['compression_savings'] = $data['written_total'] - $data['compressed_total'];
$data['thin_savings'] = $data['virtual_total'] - $data['written_total'];
$data['total_savings'] = $data['compression_savings'] + $data['dedup_savings'] + $data['thin_savings'];
$data['compression_ratio'] = ($data['compressed_total'] > 0) ? ($data['written_total'] / $data['compressed_total']) : 0;
$data['compression_savings_percent'] = ($data['written_total'] > 0) ? ($data['compression_savings'] / $data['written_total']) * 100 : 0;
$data['dedup_savings_percent'] = ($data['written_total'] > 0) ? ($data['dedup_savings'] / $data['written_total']) * 100 : 0;
$data['thin_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['thin_savings'] / $data['virtual_total']) * 100 : 0;
$data['total_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['total_savings'] / $data['virtual_total']) * 100 : 0;
}
unset($data);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard Capacité SVC</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<style>
.capacity-block .value {
font-size: 1.8rem;
font-weight: bold;
}
.capacity-block .percent {
font-size: 1rem;
font-weight: bold;
color: #555;
}
.capacity-block .label {
font-size: 0.9rem;
color: #6c757d; /* text-muted */
}
.capacity-block .sub-value {
font-size: 1.1rem;
font-weight: normal;
display: block; /* Pour mettre les valeurs de gains les unes sous les autres */
margin-bottom: 0.3rem;
}
.card-body {
min-height: 150px; /* Hauteur minimale pour aligner les cartes */
display: flex;
flex-direction: column;
justify-content: space-between;
}
.gain-item {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
font-size: 0.9rem;
}
.gain-item span:last-child {
font-weight: bold;
}
</style>
</head>
<body>
<div class="container mt-4">
<h1>Synthèse Capacité IBM Spectrum Virtualize</h1>
<hr>
<?php foreach ($seriesData as $series => $data): ?>
<h2 class="mt-5">Statistiques Baies <?= $series ?></h2>
<div class="row g-4">
<div class="col-lg-4">
<div class="card h-100">
<div class="card-body capacity-block">
<div>
<h5 class="card-title">Capacité physique</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['physical_used_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div>
<div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free']/2) ?></div>
</div>
</div>
<div class="progress" style="height: 20px;">
<div class="progress-bar" role="progressbar" style="width: <?= $data['physical_used_percent'] ?>%;" aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100">
<div class="card-body capacity-block">
<div>
<h5 class="card-title">Capacité de volume</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['volume_written_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['written_total']) ?></div>
</div>
</div>
<div class="progress" style="height: 20px;">
<div class="progress-bar" role="progressbar" style="width: <?= $data['volume_written_percent'] ?>%;" aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card ">
<div class="card-body capacity-block">
<div>
<h5 class="card-title">Gains de capacité</h5>
<div class="gain-item">
<span><?= number_format($data['compression_savings_percent'], 0) ?>% Compression</span>
<span><?= formatBytes($data['compression_savings']) ?></span>
</div>
<div class="gain-item">
<span><?= number_format($data['thin_savings_percent'], 0) ?>% Allocation dynamique</span>
<span><?= formatBytes($data['thin_savings']) ?></span>
</div>
<hr>
<div class="gain-item">
<span>Taux compression</span>
<span><?= number_format($data['compression_ratio'], 1) ?>:1</span>
</div>
</div>
</div>
</div>
</div>
</div> <?php endforeach; ?>
</div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>

View File

@@ -1,80 +1,81 @@
<?php <?php
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; global $bdnuss;
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php", ''), true); include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
$poolsData = $json['Data']['Pools']; $json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php", ''), true);
$poolsData = $json['Data']['Pools'];
function formatBytes($bytes, $precision = 2) function formatBytes($bytes, $precision = 2): string
{ {
if ($bytes == 0) if ($bytes == 0)
return '0 octets'; return '0 octets';
$base = 1024; $base = 1024;
$size = $bytes / pow($base, 4); $size = $bytes / pow($base, 4);
return round($size, $precision) . ' Tio'; return round($size, $precision) . ' Tio';
}
$seriesData = [
'V5100' => [
'physical_used' => 0,
'physical_free' => 0,
'physical_total_api' => 0,
'virtual_total' => 0,
'written_total' => 0,
'compressed_total' => 0,
'dedup_savings' => 0
],
'V5030' => [
'physical_used' => 0,
'physical_free' => 0,
'physical_total_api' => 0,
'virtual_total' => 0,
'written_total' => 0,
'compressed_total' => 0,
'dedup_savings' => 0
],
];
foreach ($poolsData as $poolName => $poolDetails) {
$currentSeries = null;
if (strpos($poolName, 'V5100') !== false) {
$currentSeries = 'V5100';
} elseif (strpos($poolName, 'V5030') !== false) {
$currentSeries = 'V5030';
} }
if ($currentSeries) {
$used_capacity = (float) $poolDetails['used_capacity'];
$free_capacity = (float) $poolDetails['free_capacity'];
$capacity = (float) $poolDetails['capacity'];
$virtual_cap = (float) $poolDetails['virtual_capacity'];
$uncomp_cap = (float) $poolDetails['compression_uncompressed_capacity'];
$comp_cap = (float) $poolDetails['compression_compressed_capacity'];
$dedup_sav = (float) $poolDetails['deduplication_capacity_saving'];
$seriesData[$currentSeries]['physical_used'] += $used_capacity; $seriesData = [
$seriesData[$currentSeries]['physical_free'] += $free_capacity; 'V5100' => [
$seriesData[$currentSeries]['physical_total_api'] += $capacity; 'physical_used' => 0,
$seriesData[$currentSeries]['virtual_total'] += $virtual_cap; 'physical_free' => 0,
$seriesData[$currentSeries]['written_total'] += $uncomp_cap; 'physical_total_api' => 0,
$seriesData[$currentSeries]['compressed_total'] += $comp_cap; 'virtual_total' => 0,
$seriesData[$currentSeries]['dedup_savings'] += $dedup_sav; 'written_total' => 0,
'compressed_total' => 0,
'dedup_savings' => 0
],
'V5030' => [
'physical_used' => 0,
'physical_free' => 0,
'physical_total_api' => 0,
'virtual_total' => 0,
'written_total' => 0,
'compressed_total' => 0,
'dedup_savings' => 0
],
];
foreach ($poolsData as $poolName => $poolDetails) {
$currentSeries = null;
if (str_contains($poolName, 'V5100')) {
$currentSeries = 'V5100';
} elseif (str_contains($poolName, 'V5030')) {
$currentSeries = 'V5030';
}
if ($currentSeries) {
$used_capacity = (float) $poolDetails['used_capacity'];
$free_capacity = (float) $poolDetails['free_capacity'];
$capacity = (float) $poolDetails['capacity'];
$virtual_cap = (float) $poolDetails['virtual_capacity'];
$uncomp_cap = (float) $poolDetails['compression_uncompressed_capacity'];
$comp_cap = (float) $poolDetails['compression_compressed_capacity'];
$dedup_sav = (float) $poolDetails['deduplication_capacity_saving'];
$seriesData[$currentSeries]['physical_used'] += $used_capacity;
$seriesData[$currentSeries]['physical_free'] += $free_capacity;
$seriesData[$currentSeries]['physical_total_api'] += $capacity;
$seriesData[$currentSeries]['virtual_total'] += $virtual_cap;
$seriesData[$currentSeries]['written_total'] += $uncomp_cap;
$seriesData[$currentSeries]['compressed_total'] += $comp_cap;
$seriesData[$currentSeries]['dedup_savings'] += $dedup_sav;
}
} }
}
foreach ($seriesData as $series => &$data) { foreach ($seriesData as $series => &$data) {
$data['physical_total_calc'] = ($data['physical_used'] + ($data['physical_free'] / 2)); $data['physical_total_calc'] = ($data['physical_used'] + ($data['physical_free'] / 2));
$data['physical_used_percent'] = ($data['physical_total_calc'] > 0) ? ($data['physical_used'] / $data['physical_total_calc']) * 100 : 0; $data['physical_used_percent'] = ($data['physical_total_calc'] > 0) ? ($data['physical_used'] / $data['physical_total_calc']) * 100 : 0;
$data['physical_free_percent'] = 100 - $data['physical_used_percent']; $data['physical_free_percent'] = 100 - $data['physical_used_percent'];
$data['volume_written_percent'] = ($data['virtual_total'] > 0) ? ($data['written_total'] / $data['virtual_total']) * 100 : 0; $data['volume_written_percent'] = ($data['virtual_total'] > 0) ? ($data['written_total'] / $data['virtual_total']) * 100 : 0;
$data['compression_savings'] = $data['written_total'] - $data['compressed_total']; $data['compression_savings'] = $data['written_total'] - $data['compressed_total'];
$data['thin_savings'] = $data['virtual_total'] - $data['written_total']; $data['thin_savings'] = $data['virtual_total'] - $data['written_total'];
$data['total_savings'] = $data['compression_savings'] + $data['dedup_savings'] + $data['thin_savings']; $data['total_savings'] = $data['compression_savings'] + $data['dedup_savings'] + $data['thin_savings'];
$data['compression_ratio'] = ($data['compressed_total'] > 0) ? ($data['written_total'] / $data['compressed_total']) : 0; $data['compression_ratio'] = ($data['compressed_total'] > 0) ? ($data['written_total'] / $data['compressed_total']) : 0;
$data['compression_savings_percent'] = ($data['written_total'] > 0) ? ($data['compression_savings'] / $data['written_total']) * 100 : 0; $data['compression_savings_percent'] = ($data['written_total'] > 0) ? ($data['compression_savings'] / $data['written_total']) * 100 : 0;
$data['dedup_savings_percent'] = ($data['written_total'] > 0) ? ($data['dedup_savings'] / $data['written_total']) * 100 : 0; $data['dedup_savings_percent'] = ($data['written_total'] > 0) ? ($data['dedup_savings'] / $data['written_total']) * 100 : 0;
$data['thin_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['thin_savings'] / $data['virtual_total']) * 100 : 0; $data['thin_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['thin_savings'] / $data['virtual_total']) * 100 : 0;
$data['total_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['total_savings'] / $data['virtual_total']) * 100 : 0; $data['total_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['total_savings'] / $data['virtual_total']) * 100 : 0;
} }
unset($data); unset($data);
?> ?>
@@ -104,59 +105,46 @@ unset($data);
<script src="/js/chart.min.js"></script> <script src="/js/chart.min.js"></script>
<style> <style>
.capacity-block .value { .capacity-block .value {
font-size: 1.8rem; font-size: 1.8rem;
font-weight: bold; font-weight: bold;
} }
.capacity-block .percent { .capacity-block .percent {
font-size: 1rem; font-size: 1rem;
font-weight: bold; font-weight: bold;
color: #555; color: #555;
} }
.capacity-block .label { .gain-item {
font-size: 0.9rem; display: flex;
color: #6c757d; justify-content: space-between;
/* text-muted */ margin-bottom: 5px;
} font-size: 0.9rem;
}
.capacity-block .sub-value { .gain-item span:last-child {
font-size: 1.1rem; font-weight: bold;
font-weight: normal; }
display: block;
margin-bottom: 0.3rem;
}
.gain-item {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
font-size: 0.9rem;
}
.gain-item span:last-child {
font-weight: bold;
}
</style> </style>
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?> <!-- Left Navbar -->
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVC Storage Dashboard</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVC Storage Dashboard</span></h1>
<!-- Main content --> <!-- Main content -->
<?php <?php
//Gold => 5100 //Gold => 5100
//Silver => 5030 //Silver => 5030
@@ -170,7 +158,7 @@ unset($data);
$lunsSilver = 0; $lunsSilver = 0;
try { try {
foreach ($json['Data']['VolumeCopies'] as $data) { foreach ($json['Data']['VolumeCopies'] as $data) {
if (strpos($data['mdisk_grp_name'], "5100") !== false) { if (str_contains($data['mdisk_grp_name'], "5100")) {
$lunsGold += $data['capacity']; $lunsGold += $data['capacity'];
} else { } else {
$lunsSilver += $data['capacity']; $lunsSilver += $data['capacity'];
@@ -185,7 +173,7 @@ unset($data);
$GoldCompression = 0; $GoldCompression = 0;
$SilverCompression = 0; $SilverCompression = 0;
foreach ($json['Data']['Pools'] as $data) { foreach ($json['Data']['Pools'] as $data) {
if (strpos($data['name'], "5100") !== false) { if (str_contains($data['name'], "5100")) {
$goldCapacity += $data['capacity']; $goldCapacity += $data['capacity'];
if ($data['used_capacity'] > 0) { if ($data['used_capacity'] > 0) {
$GoldCompression += ($data['real_capacity'] / $data['used_capacity']); $GoldCompression += ($data['real_capacity'] / $data['used_capacity']);
@@ -240,243 +228,242 @@ unset($data);
} }
} }
} }
?> ?>
<br> <br>
<!-- Carte GOLD --> <!-- Carte GOLD -->
<div class="card mb-3" style="border: 3px solid black"> <div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info"> <div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Gold (V5100)</b> <i class="fs-4 bi-server text-black"></i><b> Gold (V5100)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row g-4">
<?php $data = $seriesData['V5100']; ?>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Physical Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['physical_used_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div>
<div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
</div>
</div>
<div class="progress" style="height:30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['physical_used_percent'] ?>%;"
aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Volume Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['volume_written_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['written_total']) ?></div>
</div>
</div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['volume_written_percent'] ?>%;"
aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Capacity gain</h5>
<div class="gain-item">
<span><?= number_format($data['compression_savings_percent']) ?>% Compression</span>
<span><?= formatBytes($data['compression_savings']) ?></span>
</div>
<div class="gain-item">
<span><?= number_format($data['thin_savings_percent']) ?>% Thin provisioning</span>
<span><?= formatBytes($data['thin_savings']) ?></span>
</div>
<hr>
<div class="gain-item">
<span>Compression</span>
<span><?= number_format($data['compression_ratio'], 1) ?>:1</span>
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div class="card-body bg-dark fs-4"> </div>
<div class="row g-4"> </div>
<?php $data = $seriesData['V5100']; ?> <br>
<div class="col-lg-4"> <!-- Carte Silver -->
<div class="card h-100" style="border: none"> <div class="card mb-3" style="border: 3px solid black">
<div class="card-body capacity-block bg-dark"> <div class="card-header text-dark text-center fs-3 bg-info">
<div> <i class="fs-4 bi-server text-black"></i><b> Silver (V5030)</b>
<h5 class="card-title">Physical Capacity</h5> </div>
<div class="d-flex justify-content-between align-items-start mb-2"> <div class="card-body bg-dark fs-4">
<div> <div class="row g-4">
<span class="percent"><?= number_format($data['physical_used_percent'], 0) ?>%</span> <?php $data = $seriesData['V5030']; ?>
<div class="value"><?= formatBytes($data['physical_used']) ?></div> <div class="col-lg-4">
</div> <div class="card h-100" style="border: none">
<div class="text-end"> <div class="card-body capacity-block bg-dark">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span> <div>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div> <h5 class="card-title">Physical Capacity</h5>
</div> <div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['physical_used_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div> </div>
<div class="progress" style="height:30px;"> <div class="text-end">
<div class="progress-bar" role="progressbar" <span class="percent"><?= number_format($data['physical_free_percent']) ?>%</span>
style="width: <?= $data['physical_used_percent'] ?>%;" <div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100"> </div>
</div> </div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['physical_used_percent'] ?>%;"
aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-lg-4"> <div class="col-lg-4">
<div class="card h-100" style="border: none"> <div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark"> <div class="card-body capacity-block bg-dark">
<div> <div>
<h5 class="card-title">Volume Capacity</h5> <h5 class="card-title">Volume Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2"> <div class="d-flex justify-content-between align-items-start mb-2">
<div> <div>
<span class="percent"><?= number_format($data['volume_written_percent'], 0) ?>%</span> <span class="percent"><?= number_format($data['volume_written_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['written_total']) ?></div> <div class="value"><?= formatBytes($data['written_total']) ?></div>
</div>
</div> </div>
<div class="progress" style="height: 30px;"> </div>
<div class="progress-bar" role="progressbar" <div class="progress" style="height: 30px;">
style="width: <?= $data['volume_written_percent'] ?>%;" <div class="progress-bar" role="progressbar"
aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100"> style="width: <?= $data['volume_written_percent'] ?>%;"
</div> aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-lg-4"> <div class="col-lg-4">
<div class="card h-100" style="border: none"> <div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark"> <div class="card-body capacity-block bg-dark">
<div> <div>
<h5 class="card-title">Capacity gain</h5> <h5 class="card-title">Capacity gain</h5>
<div class="gain-item"> <div class="gain-item">
<span><?= number_format($data['compression_savings_percent'], 0) ?>% Compression</span> <span><?= number_format($data['compression_savings_percent']) ?>% Compression</span>
<span><?= formatBytes($data['compression_savings']) ?></span> <span><?= formatBytes($data['compression_savings']) ?></span>
</div> </div>
<div class="gain-item"> <div class="gain-item">
<span><?= number_format($data['thin_savings_percent'], 0) ?>% Thin provisioning</span> <span><?= number_format($data['thin_savings_percent']) ?>% Thin provisioning</span>
<span><?= formatBytes($data['thin_savings']) ?></span> <span><?= formatBytes($data['thin_savings']) ?></span>
</div> </div>
<hr> <hr>
<div class="gain-item"> <div class="gain-item">
<span>Compression</span> <span>Compression</span>
<span><?= number_format($data['compression_ratio'], 1) ?>:1</span> <span><?= number_format($data['compression_ratio'], 1) ?>:1</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div>
</div>
<hr>
<!-- IO_grp -->
<div class="row flex-nowrap text-center">
<div class="col"><!-- GRP0 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 0</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp0']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp0']['vdisk_count']; ?>
</div> </div>
</div> </div>
</div> </div>
<br> <div class="col"><!-- GRP1 -->
<!-- Carte Silver --> <div class="card border-secondary mb-3">
<div class="card mb-3" style="border: 3px solid black"> <div class="card-header text-dark text-center bg-info">
<div class="card-header text-dark text-center fs-3 bg-info"> <h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 1</h5>
<i class="fs-4 bi-server text-black"></i><b> Silver (V5030)</b> </div>
</div> <div class="card-body bg-dark text-left">
<div class="card-body bg-dark fs-4"> <b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp1']['host_count']; ?><br>
<div class="row g-4"> <b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp1']['vdisk_count']; ?>
<?php $data = $seriesData['V5030']; ?>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Physical Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['physical_used_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div>
<div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
</div>
</div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['physical_used_percent'] ?>%;"
aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Volume Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['volume_written_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['written_total']) ?></div>
</div>
</div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['volume_written_percent'] ?>%;"
aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Capacity gain</h5>
<div class="gain-item">
<span><?= number_format($data['compression_savings_percent'], 0) ?>% Compression</span>
<span><?= formatBytes($data['compression_savings']) ?></span>
</div>
<div class="gain-item">
<span><?= number_format($data['thin_savings_percent'], 0) ?>% Thin provisioning</span>
<span><?= formatBytes($data['thin_savings']) ?></span>
</div>
<hr>
<div class="gain-item">
<span>Compression</span>
<span><?= number_format($data['compression_ratio'], 1) ?>:1</span>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col"><!-- GRP2 -->
<hr> <div class="card border-secondary mb-3">
<!-- IO_grp --> <div class="card-header text-dark text-center bg-info">
<div class="row flex-nowrap text-center"> <h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 2</h5>
<div class="col"><!-- GRP0 --> </div>
<div class="card border-secondary mb-3"> <div class="card-body bg-dark">
<div class="card-header text-dark text-center bg-info"> <b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp2']['host_count']; ?><br>
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 0</h5> <b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp2']['vdisk_count']; ?>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp0']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp0']['vdisk_count']; ?>
</div>
</div> </div>
</div> </div>
<div class="col"><!-- GRP1 --> </div>
<div class="card border-secondary mb-3"> <div class="col"><!-- Orphan LUNS -->
<div class="card-header text-dark text-center bg-info"> <div class="card border-secondary mb-3">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 1</h5> <div class="card-header text-dark text-center <?php echo $cuc; ?>">
</div> <h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
<div class="card-body bg-dark text-left"> </div>
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp1']['host_count']; ?><br> <div class="card-body bg-dark text-center fs-2">
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp1']['vdisk_count']; ?> <button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
</div> data-placement="top" title="<?php echo $lLUN; ?>"><b><?php echo $unnasigned; ?></b></button>
</div> </div>
</div> </div>
<div class="col"><!-- GRP2 --> </div>
<div class="card border-secondary mb-3"> <div class="col"><!-- Orphan Hosts -->
<div class="card-header text-dark text-center bg-info"> <div class="card border-secondary mb-3">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 2</h5> <div class="card-header text-dark text-center <?php echo $chc; ?>">
</div> <h5><i class="fs-4 bi-hdd text-black"></i> Hosts w/o LUNs</h5>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp2']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp2']['vdisk_count']; ?>
</div>
</div> </div>
</div> <div class="card-body bg-dark text-center fs-2">
<div class="col"><!-- Orphan LUNS --> <button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
<div class="card border-secondary mb-3"> data-placement="top" title="<?php echo $lHOST; ?>"><b><?php echo $orphanHosts; ?></b></button>
<div class="card-header text-dark text-center <?php echo $cuc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
data-placement="top" title="<?php echo $lLUN; ?>"><b><?php echo $unnasigned; ?></b></button>
</div>
</div>
</div>
<div class="col"><!-- Orphan Hosts -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center <?php echo $chc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Hosts w/o LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
data-placement="top" title="<?php echo $lHOST; ?>"><b><?php echo $orphanHosts; ?></b></button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- End of main content -->
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</body> </body>
<script> <script>
$(function () { $(function () {

View File

@@ -1,485 +0,0 @@
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php", ''), true);
$poolsData = $json['Data']['Pools'];
function formatBytes($bytes, $precision = 2)
{
if ($bytes == 0)
return '0 octets';
$base = 1024;
$size = $bytes / pow($base, 4);
return round($size, $precision) . ' Tio';
}
$seriesData = [
'V5100' => [
'physical_used' => 0,
'physical_free' => 0,
'physical_total_api' => 0,
'virtual_total' => 0,
'written_total' => 0,
'compressed_total' => 0,
'dedup_savings' => 0
],
'V5030' => [
'physical_used' => 0,
'physical_free' => 0,
'physical_total_api' => 0,
'virtual_total' => 0,
'written_total' => 0,
'compressed_total' => 0,
'dedup_savings' => 0
],
];
foreach ($poolsData as $poolName => $poolDetails) {
$currentSeries = null;
if (strpos($poolName, 'V5100') !== false) {
$currentSeries = 'V5100';
} elseif (strpos($poolName, 'V5030') !== false) {
$currentSeries = 'V5030';
}
if ($currentSeries) {
$used_capacity = (float) $poolDetails['used_capacity'];
$free_capacity = (float) $poolDetails['free_capacity'];
$capacity = (float) $poolDetails['capacity'];
$virtual_cap = (float) $poolDetails['virtual_capacity'];
$uncomp_cap = (float) $poolDetails['compression_uncompressed_capacity'];
$comp_cap = (float) $poolDetails['compression_compressed_capacity'];
$dedup_sav = (float) $poolDetails['deduplication_capacity_saving'];
$seriesData[$currentSeries]['physical_used'] += $used_capacity;
$seriesData[$currentSeries]['physical_free'] += $free_capacity;
$seriesData[$currentSeries]['physical_total_api'] += $capacity;
$seriesData[$currentSeries]['virtual_total'] += $virtual_cap;
$seriesData[$currentSeries]['written_total'] += $uncomp_cap;
$seriesData[$currentSeries]['compressed_total'] += $comp_cap;
$seriesData[$currentSeries]['dedup_savings'] += $dedup_sav;
}
}
foreach ($seriesData as $series => &$data) {
$data['physical_total_calc'] = ($data['physical_used'] + ($data['physical_free'] / 2));
$data['physical_used_percent'] = ($data['physical_total_calc'] > 0) ? ($data['physical_used'] / $data['physical_total_calc']) * 100 : 0;
$data['physical_free_percent'] = 100 - $data['physical_used_percent'];
$data['volume_written_percent'] = ($data['virtual_total'] > 0) ? ($data['written_total'] / $data['virtual_total']) * 100 : 0;
$data['compression_savings'] = $data['written_total'] - $data['compressed_total'];
$data['thin_savings'] = $data['virtual_total'] - $data['written_total'];
$data['total_savings'] = $data['compression_savings'] + $data['dedup_savings'] + $data['thin_savings'];
$data['compression_ratio'] = ($data['compressed_total'] > 0) ? ($data['written_total'] / $data['compressed_total']) : 0;
$data['compression_savings_percent'] = ($data['written_total'] > 0) ? ($data['compression_savings'] / $data['written_total']) * 100 : 0;
$data['dedup_savings_percent'] = ($data['written_total'] > 0) ? ($data['dedup_savings'] / $data['written_total']) * 100 : 0;
$data['thin_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['thin_savings'] / $data['virtual_total']) * 100 : 0;
$data['total_savings_percent'] = ($data['virtual_total'] > 0) ? ($data['total_savings'] / $data['virtual_total']) * 100 : 0;
}
unset($data);
?>
<!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>
<style>
.capacity-block .value {
font-size: 1.8rem;
font-weight: bold;
}
.capacity-block .percent {
font-size: 1rem;
font-weight: bold;
color: #555;
}
.capacity-block .label {
font-size: 0.9rem;
color: #6c757d;
/* text-muted */
}
.capacity-block .sub-value {
font-size: 1.1rem;
font-weight: normal;
display: block;
margin-bottom: 0.3rem;
}
.gain-item {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
font-size: 0.9rem;
}
.gain-item span:last-child {
font-weight: bold;
}
</style>
</head>
<body class="bg-light text-dark">
<div class="container-fluid">
<div class="row flex-nowrap">
<!-- Left NAVBAR -->
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?> <!-- Left Navbar -->
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVC Storage Dashboard</span></h1>
<!-- Main content -->
<?php
//Gold => 5100
//Silver => 5030
$GB = 1024 * 1024 * 1024;
$TB = $GB * 1024;
//get full data
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php", ''), true);
// Sum LUN Size by Bay
$lunsGold = 0;
$lunsSilver = 0;
try {
foreach ($json['Data']['VolumeCopies'] as $data) {
if (strpos($data['mdisk_grp_name'], "5100") !== false) {
$lunsGold += $data['capacity'];
} else {
$lunsSilver += $data['capacity'];
}
}
} catch (Exception $e) {
}
// Get Full Capacity
$goldCapacity = 0;
$silverCapacity = 0;
$GoldCompression = 0;
$SilverCompression = 0;
foreach ($json['Data']['Pools'] as $data) {
if (strpos($data['name'], "5100") !== false) {
$goldCapacity += $data['capacity'];
if ($data['used_capacity'] > 0) {
$GoldCompression += ($data['real_capacity'] / $data['used_capacity']);
}
} else {
$silverCapacity += $data['capacity'];
if ($data['used_capacity'] > 0) {
$SilverCompression += ($data['real_capacity'] / $data['used_capacity']);
}
}
}
// Datas
$goldCapacity = $goldCapacity / 2;
$silverCapacity = $silverCapacity / 2;
$GoldFree = $goldCapacity - $lunsGold;
$SilverFree = $silverCapacity - $lunsSilver;
$goldPercentUsed = round($lunsGold / $goldCapacity * 100, 2);
$silverPercentUsed = round($lunsSilver / $silverCapacity * 100, 2);
$GoldCompression = round($GoldCompression / 2, 2);
$SilverCompression = round($GoldCompression / 2, 2);
// Unnasigned Luns
$unnasigned = 0;
$cuc = "bg-success";
$lLUN = "";
foreach ($json['Data']['Volumes'] as $volume) {
if ($volume['protocol'] != "scsi") {
$unnasigned++;
$cuc = "bg-warning";
$lLUN .= $volume['name'] . "<br>";
}
}
// Orphan Hosts
$orphanHosts = 0;
$chc = "bg-success";
$lHOST = "";
foreach ($json['Data']['Hosts'] as $host) {
if ($host['protocol'] != "scsi") {
$orphanHosts++;
$chc = "bg-warning";
$lHOST .= $host['name'] . "<br>";
}
}
if ($json['Data']['Hostclusters']) {
foreach ($json['Data']['Hostclusters'] as $host) {
if ($host['protocol'] != "scsi") {
$orphanHosts++;
$chc = "bg-warning";
$lHOST .= $host['name'] . "<br>";
}
}
}
?>
<br>
<!-- Carte GOLD -->
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Gold (V5100)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row g-4">
<?php $data = $seriesData['V5100']; ?>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Physical Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['physical_used_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div>
<div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
</div>
</div>
<div class="progress" style="height:30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['physical_used_percent'] ?>%;"
aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Volume Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['volume_written_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['written_total']) ?></div>
</div>
</div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['volume_written_percent'] ?>%;"
aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Capacity gain</h5>
<div class="gain-item">
<span><?= number_format($data['compression_savings_percent'], 0) ?>% Compression</span>
<span><?= formatBytes($data['compression_savings']) ?></span>
</div>
<div class="gain-item">
<span><?= number_format($data['thin_savings_percent'], 0) ?>% Thin provisioning</span>
<span><?= formatBytes($data['thin_savings']) ?></span>
</div>
<hr>
<div class="gain-item">
<span>Compression</span>
<span><?= number_format($data['compression_ratio'], 1) ?>:1</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<!-- Carte Silver -->
<div class="card mb-3" style="border: 3px solid black">
<div class="card-header text-dark text-center fs-3 bg-info">
<i class="fs-4 bi-server text-black"></i><b> Gold (V5100)</b>
</div>
<div class="card-body bg-dark fs-4">
<div class="row g-4">
<?php $data = $seriesData['V5030']; ?>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Physical Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['physical_used_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div>
<div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
</div>
</div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['physical_used_percent'] ?>%;"
aria-valuenow="<?= $data['physical_used_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Volume Capacity</h5>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="percent"><?= number_format($data['volume_written_percent'], 0) ?>%</span>
<div class="value"><?= formatBytes($data['written_total']) ?></div>
</div>
</div>
<div class="progress" style="height: 30px;">
<div class="progress-bar" role="progressbar"
style="width: <?= $data['volume_written_percent'] ?>%;"
aria-valuenow="<?= $data['volume_written_percent'] ?>" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card h-100" style="border: none">
<div class="card-body capacity-block bg-dark">
<div>
<h5 class="card-title">Capacity gain</h5>
<div class="gain-item">
<span><?= number_format($data['compression_savings_percent'], 0) ?>% Compression</span>
<span><?= formatBytes($data['compression_savings']) ?></span>
</div>
<div class="gain-item">
<span><?= number_format($data['thin_savings_percent'], 0) ?>% Thin provisioning</span>
<span><?= formatBytes($data['thin_savings']) ?></span>
</div>
<hr>
<div class="gain-item">
<span>Compression</span>
<span><?= number_format($data['compression_ratio'], 1) ?>:1</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<hr>
<!-- IO_grp -->
<div class="row flex-nowrap text-center">
<div class="col"><!-- GRP0 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 0</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp0']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp0']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- GRP1 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 1</h5>
</div>
<div class="card-body bg-dark text-left">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp1']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp1']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- GRP2 -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center bg-info">
<h5><i class="fs-4 bi-hdd-network text-black"></i> IO_grp 2</h5>
</div>
<div class="card-body bg-dark">
<b>Hosts : </b><?php echo $json['Data']['IOgroups']['io_grp2']['host_count']; ?><br>
<b>Volumes : </b><?php echo $json['Data']['IOgroups']['io_grp2']['vdisk_count']; ?>
</div>
</div>
</div>
<div class="col"><!-- Orphan LUNS -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center <?php echo $cuc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
data-placement="top" title="<?php echo $lLUN; ?>"><b><?php echo $unnasigned; ?></b></button>
</div>
</div>
</div>
<div class="col"><!-- Orphan Hosts -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark text-center <?php echo $chc; ?>">
<h5><i class="fs-4 bi-hdd text-black"></i> Hosts w/o LUNs</h5>
</div>
<div class="card-body bg-dark text-center fs-2">
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
data-placement="top" title="<?php echo $lHOST; ?>"><b><?php echo $orphanHosts; ?></b></button>
</div>
</div>
</div>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>

View File

@@ -1,67 +1,68 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<!-- Chart --> <!-- Chart -->
<script src="/js/chart.min.js"></script> <script src="/js/chart.min.js"></script>
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/all.php" ; ?> <?php include $_SERVER['DOCUMENT_ROOT']."/include/all.php" ; ?>
<?php <?php
//get full data //get full data
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php",''),true); $json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php",''),true);
// Unnasigned Luns // Unnasigned Luns
$unnasigned = 0 ; $unnasigned = 0 ;
$list = ""; $list = "";
foreach($json['Data']['Volumes'] as $volume){ foreach($json['Data']['Volumes'] as $volume){
if($volume['protocol'] != "scsi"){$unnasigned++;$list.="<tr><td>".$volume['name']."</td></tr>";} if($volume['protocol'] != "scsi"){$unnasigned++;$list.="<tr><td>".$volume['name']."</td></tr>";}
} }
?> ?>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar -->
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo "$unnasigned SVC Orphan LUN(s)" ; ?></span></h1>
<!-- Main content -->
<br>
<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="luns" data-sortable="true">Luns</th>
</thead>
<tbody>
<?php echo $list; ?>
</tbody>
</table>
</div>
<!-- End of main content -->
</div>
</div> </div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo "$unnasigned SVC Orphan LUN(s)" ; ?></span></h1>
<!-- Main content -->
<br>
<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 -->
<tr>
<th data-field="luns" data-sortable="true">Luns</th>
</tr>
</thead>
<tbody>
<?php echo $list; ?>
</tbody>
</table>
</div>
<!-- End of main content -->
</div> </div>
<script src="/js/switch.js"></script> </div>
<script src="/js/switch.js"></script>
</body> </body>

View File

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

View File

@@ -29,77 +29,80 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$answers = Invoke_infra("SELECT top(500) * FROM x_remediation_log order by ts desc"); $answers = Invoke_infra("SELECT top(500) * FROM x_remediation_log order by ts desc");
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">AutoRemediation Logs</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">AutoRemediation Logs</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</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='ts' data-sortable='true'>TimeStamp</th>
<th data-field='host' data-sortable='true'>Host</th>
<th data-field='command' data-sortable='true'>Command</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $row) {
echo '<tr>';
echo '<td class="text-nowrap">'.$row['ts'].'</td>';
echo '<td>'.$row['hostname'].'</td>';
echo '<td><small>'.$row['command'].'</small></td>';
echo '</tr>' ;
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content --> <!-- 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 -->
<tr>
<th data-field='ts' data-sortable='true'>TimeStamp</th>
<th data-field='host' data-sortable='true'>Host</th>
<th data-field='command' data-sortable='true'>Command</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $row) {
echo '<tr>';
echo '<td class="text-nowrap">'.$row['ts'].'</td>';
echo '<td>'.$row['hostname'].'</td>';
echo '<td><small>'.$row['command'].'</small></td>';
echo '</tr>' ;
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -107,22 +110,16 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script>
</SCRIPT> </SCRIPT>

View File

@@ -68,63 +68,63 @@
<!-- TABLE --> <!-- TABLE -->
<div> <div>
<?php // DATA <?php // DATA
$aix = $linux = $dun = $azt = $other = "Checked"; $aix = $linux = $dun = $azt = $other = "Checked";
$where = " and OS_TYPE IN ("; $where = " and OS_TYPE IN (";
if (isset($_GET['AIX'])) { if (isset($_GET['AIX'])) {
if ($_GET['AIX'] == 1) { if ($_GET['AIX'] == 1) {
$where .= "'AIX',"; $where .= "'AIX',";
} else {
$aix = "Unchecked";
}
} else { } else {
$aix = "Unchecked"; $aix = "Unchecked";
} }
} else { if (isset($_GET['linux'])) {
$aix = "Unchecked"; if ($_GET['linux'] == 1) {
} $where .= "'LINUX',";
if (isset($_GET['linux'])) { } else {
if ($_GET['linux'] == 1) { $linux = "Unchecked";
$where .= "'LINUX',"; }
} else { } else {
$linux = "Unchecked"; $linux = "Unchecked";
} }
} else { $where = rtrim($where, ',') . ")";
$linux = "Unchecked"; $site = "";
} if (isset($_GET['DUN'])) {
$where = rtrim($where, ',') . ")"; if ($_GET['DUN'] == 1) {
$site = ""; $site .= " or UPPER(HOSTNAME) like 'DUN%' or UPPER(HOSTNAME) like 'DMV%' or UPPER(HOSTNAME) like 'MDK%' or UPPER(HOSTNAME) like 'APPQPC%'";
if (isset($_GET['DUN'])) { } else {
if ($_GET['DUN'] == 1) { $dun = "Unchecked";
$site .= " or UPPER(HOSTNAME) like 'DUN%' or UPPER(HOSTNAME) like 'DMV%' or UPPER(HOSTNAME) like 'MDK%' or UPPER(HOSTNAME) like 'APPQPC%'"; }
} else { } else {
$dun = "Unchecked"; $dun = "Unchecked";
} }
} else { if (isset($_GET['AZT'])) {
$dun = "Unchecked"; if ($_GET['AZT'] == 1) {
} $site .= " or UPPER(HOSTNAME) like 'AZT%'";
if (isset($_GET['AZT'])) { } else {
if ($_GET['AZT'] == 1) { $azt = "Unchecked";
$site .= " or UPPER(HOSTNAME) like 'AZT%'"; }
} else { } else {
$azt = "Unchecked"; $azt = "Unchecked";
} }
} else { if (isset($_GET['other'])) {
$azt = "Unchecked"; if ($_GET['other'] == 1) {
} $site .= " or UPPER(HOSTNAME) like 'BAD%' or UPPER(HOSTNAME) like 'FLO%' or UPPER(HOSTNAME) like 'MON%'";
if (isset($_GET['other'])) { } else {
if ($_GET['other'] == 1) { $other = "Unchecked";
$site .= " or UPPER(HOSTNAME) like 'BAD%' or UPPER(HOSTNAME) like 'FLO%' or UPPER(HOSTNAME) like 'MON%'"; }
} else { } else {
$other = "Unchecked"; $other = "Unchecked";
} }
} else { $site = " and (" . ltrim($site, ' or') . ") ";
$other = "Unchecked"; $where .= $site;
}
$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"; $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); $hosts = Invoke_aixcmdb($sql);
$taix = $aixok = $aixko = $tlinux = $linuxok = $linuxko = 0; $taix = $aixok = $aixko = $tlinux = $linuxok = $linuxko = 0;
#print_r($hosts); #print_r($hosts);
?> ?>
<form class="row"> <form class="row">
<div class="col border rounded"> <div class="col border rounded">
@@ -168,72 +168,75 @@
data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']"
data-show-export="true" data-sortable="true" data-sort-name="vm"> data-show-export="true" data-sortable="true" data-sort-name="vm">
<thead> <!-- Header --> <thead> <!-- Header -->
<th data-field='host' data-sortable='true'>Host</th> <tr>
<th data-field='OS' data-sortable='true'>OS</th> <th data-field='host' data-sortable='true'>Host</th>
<th data-field='TimeStamp' data-sortable='true'>TimeStamp</th> <th data-field='OS' data-sortable='true'>OS</th>
<th data-field='RC' data-sortable='true'>RC</th> <th data-field='TimeStamp' data-sortable='true'>TimeStamp</th>
<th data-field='Result' data-sortable='true'>StdOut</th> <th data-field='RC' data-sortable='true'>RC</th>
<th data-field='Result' data-sortable='true'>StdOut</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
<?php <?php
foreach ($hosts as $h) { foreach ($hosts as $h) {
$host = strtoupper($h['HOSTNAME']); $host = strtoupper($h['HOSTNAME']);
$os = strtoupper($h['OS_TYPE']); $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 (strtoupper($h['OS_TYPE']) == "AIX") {
if ($rc == 0 && (string)$rc <> "") { $taix++;
$aixok++; } 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 { } else {
if ((string)$rc <> "") { if ($rc == 0 && (string)$rc <> "") {
$aixko++; $linuxok++;
} else {
if ((string)$rc <> "") {
$linuxko++;
}
} }
} }
} else { } else {
if ($rc == 0 && (string)$rc <> "") { $rc = $stdout = $ts = "";
$linuxok++; }
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'>" . $rc . "</td>";
} else { } else {
if ((string)$rc <> "") { echo "<td></td>";
$linuxko++;
}
} }
} }
} else { echo "<td>" . $stdout . "</td></tr>";
$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'>" . $rc . "</td>";
} else {
echo "<td></td>";
}
}
echo "<td>" . $stdout . "</td></tr>";
}
?> ?>
</tbody> </tbody>
<br> <br>
<?php <?php
$aixNO = $taix - $aixok - $aixko; $aixNO = $taix - $aixok - $aixko;
$linuxNO = $tlinux - $linuxok - $linuxko; $linuxNO = $tlinux - $linuxok - $linuxko;
echo "<div class='row'><div class='col text-center h4'><b>$taix AIX : </b>"; 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 "<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 "<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> "; ?> 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>
</div> </div>
<!-- End of main content --> <!-- End of main content -->

View File

@@ -29,58 +29,58 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Script Execution Follow-up</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Script Execution Follow-up</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase text-center" style="font-size: 1.5rem;"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center" style="font-size: 1.5rem;">
<i class="bi bi-hourglass-split"></i><br> Work in progress ... <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</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> </div>
<!-- End of main content --> <!-- 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> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>

View File

@@ -29,95 +29,98 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$answers = Invoke_WebInfraTools("SELECT * FROM sva_attributes order by sva"); $answers = Invoke_WebInfraTools("SELECT * FROM sva_attributes order by sva");
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVA & SCU Accounts Attributes <br><h6>Updated every hour</h6></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVA & SCU Accounts Attributes </span></h1><h6>Updated every hour</h6>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</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='account' data-sortable='true'>Account</th>
<th data-field='Displayname' data-sortable='true'>Displayname</th>
<th data-field='Uid' data-sortable='true'>Uid</th>
<th data-field='UidNumber' data-sortable='true'>UidNumber</th>
<th data-field='Gecos' data-sortable='true'>Gecos</th>
<th data-field='UnixHD' data-sortable='true'>Unix Home Directory</th>
<th data-field='Login Shell' data-sortable='true'>Login Shell</th>
<th data-field='GID Number' data-sortable='true'>GID Number</th>
<th data-field='Enabled' data-sortable='true'>Enabled</th>
<th data-field='LastLogon' data-sortable='true'>Last Logon</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $row) {
if ($row['enabled'] != 'True') {echo '<tr class="table-danger">';}else{echo '<tr>';}
echo '<td class="text-nowrap"><b>'.$row['SVA'].'</b></td>';
echo '<td><small>'.$row['displayname'].'</small></td>';
echo '<td><small>'.$row['uid'].'</small></td>';
echo '<td><small>'.$row['uidnumber'].'</small></td>';
echo '<td><small>'.$row['gecos'].'</small></td>';
echo '<td><small>'.$row['unixHD'].'</small></td>';
echo '<td><small>'.$row['loginshell'].'</small></td>';
echo '<td><small>'.$row['gidnumber'].'</small></td>';
echo '<td><small>'.$row['enabled'].'</small></td>';
if($row['lastlogon'] == ""){
echo '<td class="table-warning"><small><b>NEVER</b></small></td>';
}else{
echo '<td class="text-nowrap"><small>'.date_format(date_create($row['lastlogon']),"Y-m-d H:i:s").'</small></td>';
}
echo '</tr>' ;
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content --> <!-- 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 -->
<tr>
<th data-field='account' data-sortable='true'>Account</th>
<th data-field='Displayname' data-sortable='true'>Displayname</th>
<th data-field='Uid' data-sortable='true'>Uid</th>
<th data-field='UidNumber' data-sortable='true'>UidNumber</th>
<th data-field='Gecos' data-sortable='true'>Gecos</th>
<th data-field='UnixHD' data-sortable='true'>Unix Home Directory</th>
<th data-field='Login Shell' data-sortable='true'>Login Shell</th>
<th data-field='GID Number' data-sortable='true'>GID Number</th>
<th data-field='Enabled' data-sortable='true'>Enabled</th>
<th data-field='LastLogon' data-sortable='true'>Last Logon</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $row) {
if ($row['enabled'] != 'True') {echo '<tr class="table-danger">';}else{echo '<tr>';}
echo '<td class="text-nowrap"><b>'.$row['SVA'].'</b></td>';
echo '<td><small>'.$row['displayname'].'</small></td>';
echo '<td><small>'.$row['uid'].'</small></td>';
echo '<td><small>'.$row['uidnumber'].'</small></td>';
echo '<td><small>'.$row['gecos'].'</small></td>';
echo '<td><small>'.$row['unixHD'].'</small></td>';
echo '<td><small>'.$row['loginshell'].'</small></td>';
echo '<td><small>'.$row['gidnumber'].'</small></td>';
echo '<td><small>'.$row['enabled'].'</small></td>';
if($row['lastlogon'] == ""){
echo '<td class="table-warning"><small><b>NEVER</b></small></td>';
}else{
echo '<td class="text-nowrap"><small>'.date_format(date_create($row['lastlogon']),"Y-m-d H:i:s").'</small></td>';
}
echo '</tr>' ;
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -125,22 +128,16 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script>
</SCRIPT> </SCRIPT>

View File

@@ -27,7 +27,7 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- Left NAVBAR -->
@@ -38,7 +38,7 @@
<div class="col py-3"> <div class="col py-3">
<?php <?php
$server = $_GET['server']; $server = $_GET['server'];
DB_ENTRY02(); $conn = DB_ENTRY02();
$rs = $conn->query("SELECT * FROM GlobalCrossover where Server = '$server'"); $rs = $conn->query("SELECT * FROM GlobalCrossover where Server = '$server'");
?> ?>
@@ -281,9 +281,9 @@
} }
?> ?>
<input type='text' class='form-control visually-hidden' name="server" id="server" value='<?php echo $_GET['server']; ?>'> <label for="server"></label><input type='text' class='form-control visually-hidden' name="server" id="server" value='<?php echo $_GET['server']; ?>'>
<hr> <hr>
<center><button id="button" type="submit" class="btn btn-primary btn-lg"><i class="bi bi-arrow-clockwise"></i><b> Submit</b></button></center> <div style="text-align: center;"><button id="button" type="submit" class="btn btn-primary btn-lg"><i class="bi bi-arrow-clockwise"></i><b> Submit</b></button></div>
</form> </form>
</div> </div>

View File

@@ -27,7 +27,7 @@
</head> </head>
<body> <body>
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- Left NAVBAR -->
@@ -40,7 +40,7 @@
//var_dump($_POST); //var_dump($_POST);
$server = $_POST['server']; $server = $_POST['server'];
// Update Databases // Update Databases
DB_ENTRY02(); $conn = DB_ENTRY02();
if(isset($_POST['AD']) && $_POST['AD'] !==''){ if(isset($_POST['AD']) && $_POST['AD'] !==''){
$conn->query("INSERT INTO CrossoverExclusions (server,AD) VALUES ('$server','".substr($_POST['AD'], 0, 20)."') ON DUPLICATE KEY UPDATE AD ='".substr($_POST['AD'], 0, 20)."'"); $conn->query("INSERT INTO CrossoverExclusions (server,AD) VALUES ('$server','".substr($_POST['AD'], 0, 20)."') ON DUPLICATE KEY UPDATE AD ='".substr($_POST['AD'], 0, 20)."'");
$conn->query("UPDATE GlobalCrossover SET AD='".substr($_POST['AD'], 0, 20)."' where server = '$server'"); $conn->query("UPDATE GlobalCrossover SET AD='".substr($_POST['AD'], 0, 20)."' where server = '$server'");
@@ -81,13 +81,12 @@
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo $server ;?></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo $server ;?></span></h1>
<br> <br>
<div class="alert alert-success" role="alert"><h2><center>Exception(s) enregistrée(s) !</center></h2></div> <div class="alert alert-success" role="alert"><h2 class="text-center">Exception(s) enregistrée(s) !</h2></div>
<!-- <meta http-equiv="refresh" content="3;url=/crossover/Detail.php?server=<?php //echo $server ; ?>" /> --> <!-- <meta http-equiv="refresh" content="3;url=/crossover/Detail.php?server=<?php //echo $server ; ?>" /> -->
<!-- Main content --> <!-- Main content -->
</div> </div>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>

View File

@@ -1,537 +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>
<!-- 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>
<?php include $_SERVER['DOCUMENT_ROOT']."/include/preloader.inc.html" ; ?> <!-- Preloader -->
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<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%;">Global Crossover</span></h1>
<!-- Main content -->
<div class="row" style="zoom: 80%">
<!-- Get DATAs -->
<?php
// get all departements
DB_Data_Read();
$sql = "select distinct substring(dpt,1,Charindex('-',dpt)-1) as dpt1 from globalcrossover where dpt like '%-%' order by dpt1";
$rs=odbc_exec($conn,$sql);
$opt = "<select class='form-select' id='DPT' name='DPT'><option selected></option>";
while ($row = odbc_fetch_array($rs)) {
if(isset($row['dpt1'])){
$opt .= "<option value='".$row['dpt1']."*'%>".$row['dpt1']."<b>*</b></option>" ;
}
}
$opt .= "<option disabled>──────────</option>" ;
$sql = "select distinct dpt from globalcrossover where dpt <> '' order by dpt";
$rs=odbc_exec($conn,$sql);
while ($row = odbc_fetch_array($rs)) {
$opt .= "<option value='".$row['dpt']."'>".$row['dpt']."</option>" ;
}
$opt .="</select>" ;
$vir="checked";$phy="checked";$dpt="";
$where = ""; $typ="";
if(isset($_GET['AA'])){
$aa="checked"; $where .= "crit = 'AA' or ";
}else{$aa="unchecked";}
if(isset($_GET['A'])){
$a="checked"; $where .= "crit = 'A' or ";
}else{$a="unchecked";}
if(isset($_GET['B'])){
$b="checked"; $where .= "crit = 'B' or ";
}else{$b="unchecked";}
if(isset($_GET['C'])){
$c="checked"; $where .= "crit = 'C' or ";
}else{$c="unchecked";}
if(isset($_GET['no'])){
$no="checked"; $where .= "(crit = '' or crit is null) or ";
}else{$no="unchecked";}
$crit = rtrim($where, "or ");
if(isset($_GET['PHY'])){
$phy="checked";
if(!isset($_GET['VIR'])){
$typ .= " AND virtual = 'N'";
}
}else{$phy="unchecked";}
if(isset($_GET['VIR'])){
$vir="checked";
if(!isset($_GET['PHY'])){
$typ .= " AND virtual = 'Y'";
}
}else{$vir="unchecked";}
DB_Data_Read();
if($crit <> ""){
$sql = "SELECT * FROM GlobalCrossover where ($crit) and Server <> '' ";
}else{
$sql = "SELECT * FROM GlobalCrossover where Server <> '' ";
}
if($typ <> ""){
$sql .= $typ ;
}
if(isset($_GET['DPT']) && $_GET['DPT'] <> ""){
$dpt = strtoupper($_GET['DPT']);
$d = str_replace('*','',$dpt) ;
$sql .= " AND dpt like '$d%' " ;
}else{
$dpt="";
}
$sql .= " order by Server";
//echo $sql ;
$rs=odbc_exec($conn,$sql);
?>
<!-- Criticity selection -->
<form class="row row-cols-lg-auto g-3 align-items-center" action="/crossover/GlobalCrossover.php">
<div class="col-12"></div>
<div class="col-12 border rounded">
<small>
<b>Criticity Filter : </b>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="AA" <?php echo $aa;?> name="AA" value="1">
<label class="form-check-label" for="AA">AA</label>
</div>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="A" <?php echo $a;?> name="A" value="1">
<label class="form-check-label" for="A">A</label>
</div>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="B" <?php echo $b;?> name="B" value="1">
<label class="form-check-label" for="B">B</label>
</div>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="C" <?php echo $c;?> name="C" value="1">
<label class="form-check-label" for="C">C</label>
</div>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="no" <?php echo $no;?> name="no" value="1">
<label class="form-check-label" for="no">Empty</label>
</div>
</small>
</div>
<div class="col-12"></div>
<div class="col-12 border rounded">
<small>
<b>Type : </b>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="PHY" <?php echo $phy;?> name="PHY" value="1">
<label class="form-check-label" for="PHY">Physical</label>
</div>
<div class="form-check form-check-inline form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="VIR" <?php echo $vir;?> name="VIR" value="1">
<label class="form-check-label" for="VIR">Virtual</label>
</div>
</small>
</div>
<div class="col-12"></div>
<div class="col-12">
<?php echo str_replace('<option selected></option>','<option selected>'.$dpt.'</option><option></option>',$opt); ?>
</div>
<div class="col-12"></div>
<div class="col-12">
<button type="submit" class="btn btn-primary btn-small ">Apply</button>
</div>
</form>
<table class='table table-bordered table-hover table-sm' id='t1'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" data-loading-template="loadingTemplate"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="620" data-show-export="true" data-sortable="true"
>
<thead>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="OS" data-sortable="true">Operating System</th>
<th data-field="Criticity" data-sortable="true">Criticity</th>
<th data-field="Departement" data-sortable="true">Departement</th>
<th data-field="AD" data-sortable="true">AD</th>
<th data-field="ADlu" data-sortable="true" data-visible="false">AD Last Logon</th>
<th data-field="GLPI" data-sortable="true">GLPI</th>
<th data-field="GLPIlu" data-sortable="true" data-visible="false" data-footer-formatter="FI">Last FI Inventory</th>
<th data-field="SCCM" data-sortable="true">SCCM<br></th>
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</th>
<th data-field="EPO" data-sortable="true">EPO</th>
<th data-field="EPOlu" data-sortable="true" data-visible="false">EPO Last Update</th>
<th data-field="Backup" data-sortable="true">Backup</th>
<th data-field="NBUlu" data-sortable="true" data-visible="false">Last Backup</th>
</thead>
<tbody>
<!-- Display DATAs -->
<?php
$ok=0;$total=0;$nOS=0;$nAD=0;$nSCCM=0;$nGLPI=0;$nFI=0;$nEPO=0;$nNBU=0;$nDPM=0;
while ($row = odbc_fetch_array($rs)) {
$total++ ;
echo "<tr>";
if(isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && isset($row['NBU'])){
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=".$row['Server']."' target='_blank' class='link-light'>".$row['Server']."</a></b></td>";
$ok++;
}else{
echo "<td><b><a href='\crossover\Detail.php?server=".$row['Server']."' target='_blank'>".$row['Server']."</a></b></td>";
}
if($row['OS']){
if(preg_match('(XP|2003|Windows NT|2000|2008|7)', $row['OS']) !== 1) {
$nOS++;
echo "<td>".$row['OS']."</td>";
} else {
echo "<td class='bg-warning'>".$row['OS']."</td>";
}
}else{
echo "<td class='bg-warning'>&nbsp;</td>";
}
echo "<td>".$row['crit']."</td>";
echo "<td>".$row['dpt']."</td>";
// AD
if($row['AD'] == 'Y'){
$date1=date_create($row['ADlu']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 60){
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>".$row['ADlu']." (".$diff->format("%R%a")." days)</td>";
}else{
$nAD++;
echo "<td class='bg-success text-success'>OK</td>";
echo "<td class='bg-success text-white'>".$row['ADlu']."</td>";
}
}else{
if(isset($row['AD'])){
$nAD++;
echo "<td class='bg-secondary'><small>".$row['AD']."</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
}else{
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// GLPI
if($row['GLPI'] == 'Y'){
$date1=date_create($row['GLPIlu']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>".$row['GLPIlu']." (".$diff->format("%R%a")." days)</td>";
}else{
if($row['GLPIlu'] <> ""){
echo "<td class='bg-success text-success'>OK</td>";
$nFI++;
echo "<td class='bg-success text-white'>".$row['GLPIlu']."</td>";
}else{
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
echo "<td class='bg-warning text-warning'>Missing</td>";
}
}
$nGLPI++;
}else{
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
// SCCM
if($row['SCCM'] == 'Y'){
$date1=date_create($row['SCCMlu']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>".$row['SCCMlu']." (".$diff->format("%R%a")." days)</td>";
}else{
echo "<td class='bg-success text-success'>OK</td>";
echo "<td class='bg-success text-white'>".$row['SCCMlu']."</td>";
$nSCCM++;
}
}else{
if(isset($row['SCCM'])){
echo "<td class='bg-secondary'><small>".$row['SCCM']."</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
}else{
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// EPO
if($row['EPO'] == 'Y'){
$date1=date_create($row['EPOlu']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>".$row['EPOlu']." (".$diff->format("%R%a")." days)</td>";
}else{
echo "<td class='bg-success text-success'>OK</td>";
echo "<td class='bg-success text-white'>".$row['EPOlu']."</td>";
$nEPO++;
}
}else{
if(isset($row['EPO'])){
echo "<td class='bg-secondary'><small>".$row['EPO']."</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nEPO++;
}else{
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// BACKUP
if($row['NBU'] == 'Y'){
$date1=date_create($row['NBUlu']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 30){
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
echo "<td class='bg-danger text-white'>".$row['NBUlu']." (".$diff->format("%R%a")." days)</td>";
}else{
echo "<td class='bg-success text-white'>OK (NBU)</td>";
echo "<td class='bg-success text-white'>".$row['NBUlu']."</td>";
$nNBU++;
}
}else{
if($row['DPM'] == 'Y'){
$date1=date_create($row['DPMlu']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 30){
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
echo "<td class='bg-danger text-white'>".$row['DPMlu']." (".$diff->format("%R%a")." days)</td>";
}else{
echo "<td class='bg-success text-white'>OK (DPM)</td>";
echo "<td class='bg-success text-white'>".$row['DPMlu']."</td>";
$nDPM++;
}
}else{
if(isset($row['NBU'])){
echo "<td class='bg-secondary'><small>".$row['NBU']."</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
}else{
if(isset($row['DPM'])){
echo "<td class='bg-secondary'><small>".$row['DPM']."</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
}
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
}
/*
*/
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<button id="button" type="button" class="btn btn-primary btn-sm invisible"><i class="bi bi-arrow-clockwise"></i><b> Generate KPI</b></button>
<div class="row flex-nowrap text-center" style="zoom: 80%">
<div class="col"> <!-- CARTE Devices -->
<div class="card border-secondary mb-3">
<div class="card-header "><b>Devices</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIDEVICE"></span></h2>
</div>
</div>
</div>
<div class="col"> <!-- CARTE OS -->
<div class="card border-secondary mb-3">
<div class="card-header"><b>Supported OS</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIOS"></span></h2>
</div>
</div>
</div>
<div class="col"> <!-- CARTE AD -->
<div class="card border-secondary mb-3">
<div class="card-header"><b>AD</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIAD"></span></h2>
</div>
</div>
</div>
<div class="col"> <!-- CARTE GLPI/FI -->
<div class="card border-secondary mb-3">
<div class="card-header"><b>GLPI/FI</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIGLPI"></span></h2>
</div>
</div>
</div>
<div class="col"> <!-- CARTE SCCM -->
<div class="card border-secondary mb-3">
<div class="card-header"><b>SCCM</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPISCCM"></span></h2>
</div>
</div>
</div>
<div class="col"> <!-- CARTE EPO -->
<div class="card border-secondary mb-3">
<div class="card-header"><b>EPO</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIEPO"></span></h2>
</div>
</div>
</div>
<div class="col"> <!-- CARTE NBU -->
<div class="card border-secondary mb-3">
<div class="card-header"><b>Backup</b></div>
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPINBU"></span></h2>
</div>
</div>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<?php echo '<script type="text/javascript">', "$('#button').click();", '</script>' ;?>
</body>
<script>
function dateDiffInDays(a) {
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
return Math.floor((Date.now() - new Date(a)) / _MS_PER_DAY);
}
var $table = $('#t1')
var $button = $('#button')
$(function() {
$button.click(function () {
$data = $table.bootstrapTable('getData')
$dl = $data.length
$nSCCM=0; $nAD=0; $nGLPI=0;$nEPO=0;$nNBU=0;$nOS=0;
for( $i=0 ; $i < $dl ; $i++ ){
if ($data[$i]['AD'] !== 'Missing') { $nAD++ ; }
if ((dateDiffInDays($data[$i]['ADlu'].split(" ")[0]) > 60 || $data[$i]['ADlu'] == 'Missing') && $data[$i]['SCCM'] == 'OK'){ $nAD-- ;}
if ($data[$i]['SCCM'] !== 'Missing') { $nSCCM++ ; }
if ((dateDiffInDays($data[$i]['SCCMlu'].split(" ")[0]) > 7 || $data[$i]['SCCMlu'] == 'Missing') && $data[$i]['SCCM'] == 'OK'){ $nSCCM-- ;}
if ($data[$i]['GLPI'] !== 'Missing') { $nGLPI++ ; }
if ((dateDiffInDays($data[$i]['GLPIlu'].split(" ")[0]) > 7 || $data[$i]['GLPIlu'] == 'Missing') && $data[$i]['GLPI'] == 'OK'){ $nGLPI-- ;}
if ($data[$i]['EPO'] !== 'Missing') { $nEPO++ ; }
if ((dateDiffInDays($data[$i]['EPOlu'].split(" ")[0]) > 7 || $data[$i]['EPOlu'] == 'Missing') && $data[$i]['EPO'] == 'OK'){ $nEPO-- ;}
if ($data[$i]['Backup'] !== 'Missing') { $nNBU++ ; }
if ((dateDiffInDays($data[$i]['NBUlu'].split(" ")[0]) > 30 || $data[$i]['NBUlu'] == 'Missing') && $data[$i]['Backup'].split(" ")[0] == 'OK'){ $nNBU-- ;}
if (($data[$i]['OS'].includes('XP') || $data[$i]['OS'].includes('2000') || $data[$i]['OS'].includes('2003') || $data[$i]['OS'].includes('2008') || $data[$i]['OS'].includes('7') || $data[$i]['OS'].includes('Windows NT')) == false) { $nOS++ ;}
}
document.getElementById("KPIAD").innerHTML = Math.round($nAD/$dl*100) + "%";
if(Math.round($nAD/$dl*100) >=90){
document.getElementById("KPIAD").className = "badge text-bg-success font-weight-bold";
}else if(Math.round($nAD/$dl*100) >=75){
document.getElementById("KPIAD").className = "badge text-bg-warning font-weight-bold";
}else{
document.getElementById("KPIAD").className = "badge text-bg-danger font-weight-bold";
}
document.getElementById("KPIGLPI").innerHTML = Math.round($nGLPI/$dl*100) + "%";
if(Math.round($nGLPI/$dl*100) >=90){
document.getElementById("KPIGLPI").className = "badge text-bg-success font-weight-bold";
}else if(Math.round($nGLPI/$dl*100) >=75){
document.getElementById("KPIGLPI").className = "badge text-bg-warning font-weight-bold";
}else{
document.getElementById("KPIGLPI").className = "badge text-bg-danger font-weight-bold";
}
document.getElementById("KPISCCM").innerHTML = Math.round($nSCCM/$dl*100) + "%";
if(Math.round($nSCCM/$dl*100) >=90){
document.getElementById("KPISCCM").className = "badge text-bg-success font-weight-bold";
}else if(Math.round($nSCCM/$dl*100) >=75){
document.getElementById("KPISCCM").className = "badge text-bg-warning font-weight-bold";
}else{
document.getElementById("KPISCCM").className = "badge text-bg-danger font-weight-bold";
}
document.getElementById("KPIEPO").innerHTML = Math.round($nEPO/$dl*100) + "%";
if(Math.round($nEPO/$dl*100) >=90){
document.getElementById("KPIEPO").className = "badge text-bg-success font-weight-bold";
}else if(Math.round($nEPO/$dl*100) >=75){
document.getElementById("KPIEPO").className = "badge text-bg-warning font-weight-bold";
}else{
document.getElementById("KPIEPO").className = "badge text-bg-danger font-weight-bold";
}
document.getElementById("KPINBU").innerHTML = Math.round($nNBU/$dl*100) + "%";
if(Math.round($nNBU/$dl*100) >=90){
document.getElementById("KPINBU").className = "badge text-bg-success font-weight-bold";
}else if(Math.round($nNBU/$dl*100) >=75){
document.getElementById("KPINBU").className = "badge text-bg-warning font-weight-bold";
}else{
document.getElementById("KPINBU").className = "badge text-bg-danger font-weight-bold";
}
document.getElementById("KPIOS").innerHTML = Math.round($nOS/$dl*100) + "%";
if(Math.round($nOS/$dl*100) >=90){
document.getElementById("KPIOS").className = "badge text-bg-success font-weight-bold";
}else if(Math.round($nOS/$dl*100) >=75){
document.getElementById("KPIOS").className = "badge text-bg-warning font-weight-bold";
}else{
document.getElementById("KPIOS").className = "badge text-bg-danger font-weight-bold";
}
document.getElementById("KPIDEVICE").innerHTML = $dl;
})
})
$table.on('all.bs.table', function () {
var $button = $('#button')
$button.click() ;
})
</script>
<!-- remove preloader after loading -->
<script>
$(window).on('load', function() {
$('.preloader').addClass('preloader-deactivate');
});
</script>

View File

@@ -30,7 +30,7 @@
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader -->
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/db_connect.php"; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/../../include/db_connect.php"; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
@@ -45,58 +45,12 @@
<!-- Main content --> <!-- Main content -->
<div class="row" style="zoom: 80%"> <div class="row" style="zoom: 80%">
<!-- Get DATAs -->
<?php
DB_ENTRY02();
$result = $conn->query("select * from GlobalCrossover where server not like 'WS%' order by server ");
if (isset($_GET['filter'])) {
switch ($_GET['filter']) {
case "AD":
$result = $conn->query("select * from GlobalCrossover where AD is null or (ADlu is not null and DATEDIFF(now(),ADlu) > 45) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : AD non compliant</span></center></h2>";
break;
case "OS":
$result = $conn->query("select * from GlobalCrossover where OS like '%2003%' or OS like '%2008%' order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : OS non compliant</span></center></h2>";
break;
case "GLPI":
$result = $conn->query("select * from GlobalCrossover where GLPI is null or GLPIlu is null or DATEDIFF(now(),GLPIlu) > 7 order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : GLPI/FI non compliant</span></center></h2>";
break;
case "SCCM":
$result = $conn->query("select * from GlobalCrossover where SCCM is null or (SCCMlu is not null and DATEDIFF(now(),SCCMlu) > 7) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCCM non compliant</span></center></h2>";
break;
case "NESSUS":
$result = $conn->query("select * from GlobalCrossover where EPO is null order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : NESSUS non compliant</span></center></h2>";
break;
case "NBU":
$result = $conn->query("select * from GlobalCrossover where NBU is null or (NBUlu is not null and DATEDIFF(now(),NBUlu) > 30) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Backup non compliant</span></center></h2>";
break;
case "SCOM":
$result = $conn->query("select * from GlobalCrossover where SCOM is null order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCOM non compliant</span></center></h2>";
break;
case "zabbix":
$result = $conn->query("select * from GlobalCrossover where zabbix is null order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Zabbix non compliant</span></center></h2>";
break;
case "S1":
$result = $conn->query("select * from GlobalCrossover where S1 is null or (S1lu is not null and DATEDIFF(now(),S1lu) > 7) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SentinelOne non compliant</span></center></h2>";
break;
default:
}
}
?>
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true" <table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true"
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
data-height="620" data-show-export="true" data-sortable="true"> data-show-export="true" data-sortable="true">
<thead> <thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="OS" data-sortable="true">Operating System</th> <th data-field="OS" data-sortable="true">Operating System</th>
<th data-field="Criticity" data-sortable="true">Criticity</th> <th data-field="Criticity" data-sortable="true">Criticity</th>
@@ -115,222 +69,226 @@
<th data-field="Zabbix" data-sortable="true">Zabbix</th> <th data-field="Zabbix" data-sortable="true">Zabbix</th>
<th data-field="S1" data-sortable="true">SentinelOne</th> <th data-field="S1" data-sortable="true">SentinelOne</th>
<th data-field="S1lu" data-sortable="true" data-visible="false">S1 Last Update</th> <th data-field="S1lu" data-sortable="true" data-visible="false">S1 Last Update</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->
<?php <?php
$conn = DB_ENTRY02();
// Base query
$sql = "SELECT * FROM GlobalCrossover";
$whereClauses = ["server NOT LIKE 'WS%'"];
$params = [];
$types = "";
$ok = 0; // Handle filters securely using prepared statements
$total = 0; if (isset($_GET['filter'])) {
$nOS = 0; $filter = $_GET['filter'];
$nAD = 0; $filterTitle = "Filter : " . htmlspecialchars($filter) . " non compliant";
$nSCCM = 0;
$nGLPI = 0; switch ($filter) {
$nFI = 0; case "AD":
$nNESSUS = 0; $whereClauses[] = "AD IS NULL OR (ADlu IS NOT NULL AND DATEDIFF(now(), ADlu) > 45)";
$nNBU = 0; break;
$nDPM = 0; case "OS":
$nS1 = 0; $whereClauses[] = "OS LIKE '%2003%' OR OS LIKE '%2008%'";
while ($row = mysqli_fetch_array($result)) { break;
$total++; case "GLPI":
echo "<tr>"; $whereClauses[] = "GLPI IS NULL OR GLPIlu IS NULL OR DATEDIFF(now(), GLPIlu) > 7";
if (isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM'])) { break;
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank' class='link-light'>" . $row['Server'] . "</a></b></td>"; case "SCCM":
//echo "<td class='bg-success text-white'><b>".$row['Server']."</b></td>"; $whereClauses[] = "SCCM IS NULL OR (SCCMlu IS NOT NULL AND DATEDIFF(now(), SCCMlu) > 7)";
$ok++; break;
} else { case "NESSUS":
echo "<td><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank'>" . $row['Server'] . "</a></b></td>"; $whereClauses[] = "EPO IS NULL";
//echo "<td><b>".$row['Server']."</b></td>"; break;
} case "NBU":
if ($row['OS']) { $whereClauses[] = "NBU IS NULL OR (NBUlu IS NOT NULL AND DATEDIFF(now(), NBUlu) > 30)";
if (preg_match('(XP|2003|Windows NT|2000|2008|Windows 7|2012)', $row['OS']) !== 1) { break;
$nOS++; case "SCOM":
echo "<td>" . $row['OS'] . "</td>"; $whereClauses[] = "SCOM IS NULL";
} else { break;
echo "<td class='bg-warning text-black'>" . $row['OS'] . "</td>"; case "zabbix":
$whereClauses[] = "zabbix IS NULL";
break;
case "S1":
$whereClauses[] = "S1 IS NULL OR (S1lu IS NOT NULL AND DATEDIFF(now(), S1lu) > 7)";
break;
default:
$filterTitle = null; // No valid filter
break;
} }
} else {
echo "<td class='bg-warning'>&nbsp;</td>";
}
echo "<td>" . $row['crit'] . "</td>";
echo "<td>" . $row['dpt'] . "</td>";
// AD if ($filterTitle) {
if ($row['AD'] == 'Y') { echo "<h2><div style=\"text-align: center;\"><span class='badge text-bg-danger font-weight-bold'>$filterTitle</span></div></h2>";
$date1 = date_create($row['ADlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 45) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['ADlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
$nAD++;
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['ADlu'] . "</td>";
}
} else {
if (isset($row['AD'])) {
$nAD++;
echo "<td class='bg-secondary'><small>" . $row['AD'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-black'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
} }
} }
// GLPI // Combine all WHERE clauses
if ($row['GLPI'] == 'Y') { if (!empty($whereClauses)) {
$date1 = date_create($row['GLPIlu']); $sql .= " WHERE " . implode(' AND ', $whereClauses);
$diff = date_diff($date1, date_create(date("Y-m-d"))); }
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>"; $sql .= " ORDER BY server";
echo "<td class='bg-danger text-white'>" . $row['GLPIlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else { // Prepare and execute the query
if ($row['GLPIlu'] <> "" || $row['FI'] <> "") { $stmt = $conn->prepare($sql);
echo "<td class='bg-success text-white'>OK</td>"; // Note: If you had parameters, you would bind them here, e.g., $stmt->bind_param($types, ...$params);
$nFI++; $stmt->execute();
echo "<td class='bg-success text-white'>" . $row['GLPIlu'] . "</td>"; $result = $stmt->get_result();
} else {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
echo "<td class='bg-warning text-black'>Missing</td>"; // --- PART 2: HELPER FUNCTIONS FOR RENDERING ---
/**
* Renders a standard status cell based on a value and its last update date.
* @param string|null $status The status value (e.g., 'Y', 'N').
* @param string|null $lastUpdate The date of the last update.
* @param int $daysThreshold The number of days to be considered "out of date".
* @param string $okText Text to display for OK status (e.g., "OK", "OK (NBU)").
* @return string The generated HTML for two <td> cells.
*/
function renderStatusCellWithDate(?string $status, ?string $lastUpdate, int $daysThreshold, string $okText = 'OK'): string {
// Sanitize output to prevent XSS
$status = htmlspecialchars($status ?? '', ENT_QUOTES, 'UTF-8');
$lastUpdate = htmlspecialchars($lastUpdate ?? '', ENT_QUOTES, 'UTF-8');
$okText = htmlspecialchars($okText, ENT_QUOTES, 'UTF-8');
if ($status === 'Y') {
if (empty($lastUpdate)) {
// Status is OK, but date is missing
return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>$okText</td>"
. "<td class='bg-warning text-black'>Missing</td>";
} }
}
$nGLPI++;
} else {
if (isset($row['GLPI'])) {
echo "<td class='bg-secondary'><small>" . $row['GLPI'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nGLPI++;
} else {
echo "<td class='bg-warning text-black'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// SCCM try {
if ($row['SCCM'] == 'Y') { $diff = date_diff(date_create($lastUpdate), date_create());
$date1 = date_create($row['SCCMlu']); $days = (int) $diff->format("%R%a");
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['SCCMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['SCCMlu'] . "</td>";
$nSCCM++;
}
} else {
if (isset($row['SCCM'])) {
echo "<td class='bg-secondary'><small>" . $row['SCCM'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-black'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// NESSUS if ($days > $daysThreshold) {
if (strpos($row['EPO'], '.') !== false ) { // Out of date
echo "<td class='bg-success text-white'>".$row['EPO']."</td>"; return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>$okText</td>"
} else { . "<td class='bg-danger text-white'>$lastUpdate ($days days)</td>";
if (isset($row['EPO']) && $row['EPO'] != 'Y' && $row['EPO'] != 'N') { } else {
echo "<td class='bg-secondary'><small>" . $row['EPO'] . "</small></td>"; // Compliant
} else { return "<td class='bg-success text-white'>$okText</td>"
echo "<td class='bg-warning text-black'>Missing</td>"; . "<td class='bg-success text-white'>$lastUpdate</td>";
$nNESSUS++;
}
}
// BACKUP
if ($row['NBU'] == 'Y') {
$date1 = date_create($row['NBUlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 30) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
echo "<td class='bg-danger text-white'>" . $row['NBUlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK (NBU)</td>";
echo "<td class='bg-success text-white'>" . $row['NBUlu'] . "</td>";
$nNBU++;
}
} else {
if ($row['DPM'] == 'Y') {
$date1 = date_create($row['DPMlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 30) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
echo "<td class='bg-danger text-white'>" . $row['DPMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK (DPM)</td>";
echo "<td class='bg-success text-white'>" . $row['DPMlu'] . "</td>";
$nDPM++;
}
} else {
if (isset($row['NBU'])) {
echo "<td class='bg-secondary'><small>" . $row['NBU'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
} else {
if (isset($row['DPM'])) {
echo "<td class='bg-secondary'><small>" . $row['DPM'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
} }
echo "<td class='bg-warning text-black'>Missing</td>"; } catch (Exception) {
echo "<td class='bg-warning text-warning'>&nbsp;</td>"; // Handle invalid date format gracefully
return "<td class='bg-danger text-white'>Invalid Date</td><td class='bg-danger text-white'>$lastUpdate</td>";
} }
} }
if ($status !== '') {
// Not applicable, non-supported, etc.
return "<td class='bg-secondary'><small>$status</small></td><td class='bg-secondary text-secondary'>&nbsp;</td>";
}
// Missing
return "<td class='bg-warning text-black'>Missing</td><td class='bg-warning text-warning'>&nbsp;</td>";
} }
// SCOM // --- PART 3: CLEAN DATA DISPLAY LOOP ---
if ($row['SCOM'] == 'Y') {
echo "<td class='bg-success text-white'>OK</td>"; // Initialize counters
} else { $counters = [
if (isset($row['SCOM'])) { 'total' => 0, 'ok' => 0, 'nOS' => 0, 'nAD' => 0, 'nSCCM' => 0, 'nGLPI' => 0,
echo "<td class='bg-secondary'><small>" . $row['SCOM'] . "</small></td>"; 'nFI' => 0, 'nNESSUS' => 0, 'nNBU' => 0, 'nDPM' => 0, 'nS1' => 0
];
while ($row = $result->fetch_assoc()) {
$counters['total']++;
// Sanitize server name for URL and display
$serverName = htmlspecialchars($row['Server'], ENT_QUOTES, 'UTF-8');
$serverUrl = urlencode($row['Server']);
// Determine overall row status
$isCompliant = isset($row['AD'], $row['GLPI'], $row['SCCM'], $row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM']);
if ($isCompliant) {
$counters['ok']++;
$serverCell = "<td class='bg-success text-white'><b><a href='/crossover/Detail.php?server=$serverUrl' target='_blank' class='link-light'>$serverName</a></b></td>";
} else {
$serverCell = "<td><b><a href='/crossover/Detail.php?server=$serverUrl' target='_blank'>$serverName</a></b></td>";
}
// OS Cell
$osCell = "<td class='bg-warning'>&nbsp;</td>";
if (!empty($row['OS'])) {
$os = htmlspecialchars($row['OS']);
if (preg_match('(XP|2003|2000|2008|Windows 7|2012)', $row['OS'])) {
$osCell = "<td class='bg-warning text-black'>$os</td>";
} else {
$counters['nOS']++;
$osCell = "<td>$os</td>";
}
}
echo "<tr>";
echo $serverCell;
echo $osCell;
echo "<td>" . htmlspecialchars($row['crit'] ?? '') . "</td>";
echo "<td>" . htmlspecialchars($row['dpt'] ?? '') . "</td>";
// Use helper function for status columns
echo renderStatusCellWithDate($row['AD'], $row['ADlu'], 45);
echo renderStatusCellWithDate($row['GLPI'], $row['GLPIlu'], 7);
echo renderStatusCellWithDate($row['SCCM'], $row['SCCMlu'], 7);
// NESSUS (EPO) Cell - Custom logic
if (str_contains($row['EPO'] ?? '', '.')) {
echo "<td class='bg-success text-white'>" . htmlspecialchars($row['EPO']) . "</td>";
} elseif (isset($row['EPO']) && !in_array($row['EPO'], ['Y', 'N'])) {
echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['EPO']) . "</small></td>";
} else {
echo "<td class='bg-warning text-black'>Missing</td>";
$counters['nNESSUS']++;
}
// BACKUP Cell - Custom logic for NBU/DPM
if ($row['NBU'] === 'Y') {
echo renderStatusCellWithDate($row['NBU'], $row['NBUlu'], 30, 'OK (NBU)');
} elseif ($row['DPM'] === 'Y') {
echo renderStatusCellWithDate($row['DPM'], $row['DPMlu'], 30, 'OK (DPM)');
} else {
// Handle non-Y cases for NBU or DPM, or missing
$backupStatus = $row['NBU'] ?? $row['DPM'] ?? null;
echo renderStatusCellWithDate($backupStatus, null, 30);
}
// SCOM Cell - Simple logic
if ($row['SCOM'] === 'Y') {
echo "<td class='bg-success text-white'>OK</td>";
} elseif (isset($row['SCOM'])) {
echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['SCOM']) . "</small></td>";
} else { } else {
echo "<td class='bg-warning text-black'>Missing</td>"; echo "<td class='bg-warning text-black'>Missing</td>";
} }
}
// zabbix // Zabbix Cell - Simple logic
if ($row['zabbix'] == 'Y' || strpos($row['zabbix'], '.') !== false ) { $zabbixStatus = $row['zabbix'] ?? '';
echo "<td class='bg-success text-white'>".str_replace('Y','OK',$row['zabbix'])."</td>"; if ($zabbixStatus === 'Y' || str_contains($zabbixStatus, '.')) {
} else { echo "<td class='bg-success text-white'>" . htmlspecialchars(str_replace('Y', 'OK', $zabbixStatus)) . "</td>";
if (isset($row['zabbix'])) { } elseif (isset($row['zabbix'])) {
echo "<td class='bg-secondary'><small>" . $row['zabbix'] . "</small></td>"; echo "<td class='bg-secondary'><small>" . htmlspecialchars($zabbixStatus) . "</small></td>";
} else { } else {
echo "<td class='bg-warning text-black'>Missing</td>"; echo "<td class='bg-warning text-black'>Missing</td>";
} }
}
// S1 // S1 Cell
if ($row['S1'] == 'Y' || strpos($row['S1'], '.') !== false) { $s1Status = $row['S1'] ?? '';
$date1 = date_create($row['S1lu']); $s1Text = ($s1Status === 'Y' || str_contains($s1Status, '.')) ? str_replace('Y', 'OK', $s1Status) : 'OK';
$diff = date_diff($date1, date_create(date("Y-m-d"))); echo renderStatusCellWithDate($s1Status, $row['S1lu'], 7, $s1Text);
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>".str_replace('Y','OK',$row['S1'])."</td>"; echo "</tr>";
echo "<td class='bg-danger text-white'>" . $row['S1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>".str_replace('Y','OK',$row['S1'])."</td>";
echo "<td class='bg-success text-white'>" . $row['S1lu'] . "</td>";
$nS1++;
}
} else {
if (isset($row['S1'])) {
if($row['S1'] == "N"){$row['S1'] = "Non Supported OS";}
echo "<td class='bg-secondary'><small>" . $row['S1'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nS1++;
} else {
echo "<td class='bg-warning text-black'>Missing</td>";
echo "<td class='bg-warning text-black'>&nbsp;</td>";
}
} }
echo "</tr>"; // You can now use the $counters array to pass data to your JS for the KPIs
} // For example:
echo "<script>let kpiData = " . json_encode($counters) . ";</script>";
$stmt->close();
$conn->close();
?> ?>
</tbody> </tbody>
@@ -450,19 +408,48 @@
<script src="/crossover/Crossover-KPI.js"></script> <script src="/crossover/Crossover-KPI.js"></script>
<script> <script>
var $table = $('#t1') let $table = $('#t1');
var $button = $('#button') const $button = $('#button');
$table.on('search.bs.table', function () { $table.on('search.bs.table', function () {
var $button = $('#button') let $button = $('#button');
$button.click(); $button.click();
}) })
$(window).on('load', function () { $(window).on('load', function () {
$('.preloader').addClass('preloader-deactivate'); $('.preloader').addClass('preloader-deactivate');
}); });
document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { document.getElementById('button').click(); }, 1000); }); document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { $('#button').click(); }, 1000); });
</script> </script>
<SCRIPT>
$(function() {
// Exécution initiale pour définir la hauteur
adjustTableHeight();
// Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight();
});
function adjustTableHeight() {
const table = $('#t1');
const windowHeight = $(window).height();
const tableTop = table.offset().top;
const footerHeight = -50; // Hauteur estimée pour d'éventuels éléments en bas
let availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
table.bootstrapTable('refreshOptions', {
height: availableHeight
});
}
});
</script>
</HTML> </HTML>

View File

@@ -1,448 +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">
<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/preloader.inc.html"; ?> <!-- Preloader -->
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/db_connect.php"; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<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%;">Global Crossover</span></h1>
<!-- Main content -->
<div class="row" style="zoom: 80%">
<!-- Get DATAs -->
<?php
DB_ENTRY02();
$result = $conn->query("select * from GlobalCrossover where server not like 'WS%' order by server ");
if (isset($_GET['filter'])) {
switch ($_GET['filter']) {
case "AD":
$result = $conn->query("select * from GlobalCrossover where AD is null or (ADlu is not null and DATEDIFF(now(),ADlu) > 45) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : AD non compliant</span></center></h2>";
break;
case "OS":
$result = $conn->query("select * from GlobalCrossover where OS like '%2003%' or OS like '%2008%' order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : OS non compliant</span></center></h2>";
break;
case "GLPI":
$result = $conn->query("select * from GlobalCrossover where GLPI is null or GLPIlu is null or DATEDIFF(now(),GLPIlu) > 7 order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : GLPI/FI non compliant</span></center></h2>";
break;
case "SCCM":
$result = $conn->query("select * from GlobalCrossover where SCCM is null or (SCCMlu is not null and DATEDIFF(now(),SCCMlu) > 7) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCCM non compliant</span></center></h2>";
break;
case "EPO":
$result = $conn->query("select * from GlobalCrossover where EPO is null or (EPOlu is not null and DATEDIFF(now(),EPOlu) > 7) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : EPO non compliant</span></center></h2>";
break;
case "NBU":
$result = $conn->query("select * from GlobalCrossover where NBU is null or (NBUlu is not null and DATEDIFF(now(),NBUlu) > 30) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Backup non compliant</span></center></h2>";
break;
case "SCOM":
$result = $conn->query("select * from GlobalCrossover where SCOM is null order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCOM non compliant</span></center></h2>";
break;
case "zabbix":
$result = $conn->query("select * from GlobalCrossover where zabbix is null order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Zabbix non compliant</span></center></h2>";
break;
case "S1":
$result = $conn->query("select * from GlobalCrossover where S1 is null or (S1lu is not null and DATEDIFF(now(),S1lu) > 7) order by server");
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SentinelOne non compliant</span></center></h2>";
break;
default:
}
}
?>
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true"
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
data-height="620" data-show-export="true" data-sortable="true">
<thead>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="OS" data-sortable="true">Operating System</th>
<th data-field="Criticity" data-sortable="true">Criticity</th>
<th data-field="Departement" data-sortable="true" data-visible="false">Departement</th>
<th data-field="AD" data-sortable="true">AD</th>
<th data-field="ADlu" data-sortable="true" data-visible="false">AD Last Logon</th>
<th data-field="GLPI" data-sortable="true">GLPI</th>
<th data-field="GLPIlu" data-sortable="true" data-visible="false" data-footer-formatter="FI">Last FI
Inventory
</th>
<th data-field="SCCM" data-sortable="true">SCCM<br></th>
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</th>
<th data-field="Backup" data-sortable="true">Backup</th>
<th data-field="NBUlu" data-sortable="true" data-visible="false">Last Backup</th>
<th data-field="SCOM" data-sortable="true">SCOM</th>
<th data-field="Zabbix" data-sortable="true">Zabbix</th>
<th data-field="S1" data-sortable="true">SentinelOne</th>
<th data-field="S1lu" data-sortable="true" data-visible="false">S1 Last Update</th>
</thead>
<tbody>
<!-- Display DATAs -->
<?php
$ok = 0;
$total = 0;
$nOS = 0;
$nAD = 0;
$nSCCM = 0;
$nGLPI = 0;
$nFI = 0;
$nNBU = 0;
$nDPM = 0;
$nS1 = 0;
while ($row = mysqli_fetch_array($result)) {
$total++;
echo "<tr>";
if (isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM'])) {
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank' class='link-light'>" . $row['Server'] . "</a></b></td>";
//echo "<td class='bg-success text-white'><b>".$row['Server']."</b></td>";
$ok++;
} else {
echo "<td><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank'>" . $row['Server'] . "</a></b></td>";
//echo "<td><b>".$row['Server']."</b></td>";
}
if ($row['OS']) {
if (preg_match('(XP|2003|Windows NT|2000|2008|Windows 7|2012)', $row['OS']) !== 1) {
$nOS++;
echo "<td>" . $row['OS'] . "</td>";
} else {
echo "<td class='bg-warning'>" . $row['OS'] . "</td>";
}
} else {
echo "<td class='bg-warning'>&nbsp;</td>";
}
echo "<td>" . $row['crit'] . "</td>";
echo "<td>" . $row['dpt'] . "</td>";
// AD
if ($row['AD'] == 'Y') {
$date1 = date_create($row['ADlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 45) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['ADlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
$nAD++;
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['ADlu'] . "</td>";
}
} else {
if (isset($row['AD'])) {
$nAD++;
echo "<td class='bg-secondary'><small>" . $row['AD'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// GLPI
if ($row['GLPI'] == 'Y') {
$date1 = date_create($row['GLPIlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['GLPIlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
if ($row['GLPIlu'] <> "" || $row['FI'] <> "") {
echo "<td class='bg-success text-white'>OK</td>";
$nFI++;
echo "<td class='bg-success text-white'>" . $row['GLPIlu'] . "</td>";
} else {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
echo "<td class='bg-warning text-warning'>Missing</td>";
}
}
$nGLPI++;
} else {
if (isset($row['GLPI'])) {
echo "<td class='bg-secondary'><small>" . $row['GLPI'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nGLPI++;
} else {
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// SCCM
if ($row['SCCM'] == 'Y') {
$date1 = date_create($row['SCCMlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['SCCMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['SCCMlu'] . "</td>";
$nSCCM++;
}
} else {
if (isset($row['SCCM'])) {
echo "<td class='bg-secondary'><small>" . $row['SCCM'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
// BACKUP
if ($row['NBU'] == 'Y') {
$date1 = date_create($row['NBUlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 30) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
echo "<td class='bg-danger text-white'>" . $row['NBUlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK (NBU)</td>";
echo "<td class='bg-success text-white'>" . $row['NBUlu'] . "</td>";
$nNBU++;
}
} else {
if ($row['DPM'] == 'Y') {
$date1 = date_create($row['DPMlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 30) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
echo "<td class='bg-danger text-white'>" . $row['DPMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK (DPM)</td>";
echo "<td class='bg-success text-white'>" . $row['DPMlu'] . "</td>";
$nDPM++;
}
} else {
if (isset($row['NBU'])) {
echo "<td class='bg-secondary'><small>" . $row['NBU'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
} else {
if (isset($row['DPM'])) {
echo "<td class='bg-secondary'><small>" . $row['DPM'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
}
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
}
// SCOM
if ($row['SCOM'] == 'Y') {
echo "<td class='bg-success text-white'>OK</td>";
} else {
if (isset($row['SCOM'])) {
echo "<td class='bg-secondary'><small>" . $row['SCOM'] . "</small></td>";
} else {
echo "<td class='bg-warning text-warning'>Missing</td>";
}
}
// zabbix
if ($row['zabbix'] == 'Y' || strpos($row['zabbix'], '.') !== false) {
echo "<td class='bg-success text-white'>" . str_replace('Y', 'OK', $row['zabbix']) . "</td>";
} else {
if (isset($row['zabbix'])) {
echo "<td class='bg-secondary'><small>" . $row['zabbix'] . "</small></td>";
} else {
echo "<td class='bg-warning text-warning'>Missing</td>";
}
}
// S1
if ($row['S1'] == 'Y') {
$date1 = date_create($row['S1lu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['S1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['S1lu'] . "</td>";
$nS1++;
}
} else {
if (isset($row['S1'])) {
echo "<td class='bg-secondary'><small>" . $row['S1'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nS1++;
} else {
echo "<td class='bg-warning text-warning'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<button id="button" type="button" class="btn btn-primary btn-sm invisible"><i
class="bi bi-arrow-clockwise"></i><b> Generate KPI</b></button>
<div class="row flex-nowrap text-center" style="zoom: 80%">
<div class="col"> <!-- CARTE Devices -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>All Devices</b></div>
<a href="/crossover/GlobalCrossover.php">
<div class="card-body">
<h2><span class="badge text-bg-primary font-weight-bold" id="KPIDEVICE"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE OS -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>Supported OS</b></div>
<a href="/crossover/GlobalCrossover.php?filter=OS">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIOS"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE AD -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>AD</b></div>
<a href="/crossover/GlobalCrossover.php?filter=AD">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIAD"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE GLPI/FI -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>GLPI/FI</b></div>
<a href="/crossover/GlobalCrossover.php?filter=GLPI">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIGLPI"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE SCCM -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>SCCM</b></div>
<a href="/crossover/GlobalCrossover.php?filter=SCCM">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPISCCM"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE Backup (NBU + DPM) -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>Backup</b></div>
<a href="/crossover/GlobalCrossover.php?filter=NBU">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPINBU"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE SCOM -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>SCOM</b></div>
<a href="/crossover/GlobalCrossover.php?filter=SCOM">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPISCOM"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE Zabbix -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>Zabbix</b></div>
<a href="/crossover/GlobalCrossover.php?filter=zabbix">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIzabbix"></span></h2>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE SentinelOne -->
<div class="card border-secondary mb-3">
<div class="card-header text-dark"><b>SentinelOne</b></div>
<a href="/crossover/GlobalCrossover.php?filter=S1">
<div class="card-body">
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIS1"></span></h2>
</div>
</a>
</div>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
<script src="/js/switch.js"></script>
</body>
<script src="/crossover/Crossover-KPI.js"></script>
<script>
var $table = $('#t1')
var $button = $('#button')
$table.on('search.bs.table', function () {
var $button = $('#button')
$button.click();
})
$(window).on('load', function () {
$('.preloader').addClass('preloader-deactivate');
});
document.addEventListener("DOMContentLoaded", function () {
setTimeout(function () {
document.getElementById('button').click();
}, 1000);
});
</script>
</HTML>

View File

@@ -1,91 +1,95 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/../../include/db_connect.php"; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?> <!-- Left Navbar -->
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Active Directory</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Active Directory</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php
$conn = DB_ENTRY02();
$rs = $conn->query('SELECT * FROM ADComputers order by name');
?>
<table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true"
data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820"
data-show-export="true" data-sortable="true"
>
<thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="OS" data-sortable="true">OS</th>
<th data-field="Enabled" data-sortable="true">Enabled</th>
<th data-field="LasLogon" data-sortable="true">Last Logon</th>
<th data-field="OU" data-visible="false">OU</th>
</tr>
</thead>
<tbody>
<!-- Display DATAs -->
<?php <?php
DB_ENTRY02(); while ($row = mysqli_fetch_array($rs)) {
$rs = $conn->query('SELECT * FROM ADComputers order by name'); echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['os'] . "</td>";
// Change color cell if enabled = False
if ($row['enabled'] == "False") {
echo "<td class='bg-warning'>" . $row['enabled'] . "</td>";
} else {
echo "<td>" . $row['enabled'] . "</td>";
}
// Change cell color if lastlogon > 1 month
$date1 = date_create($row['lastlogon']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 30 || !($row['lastlogon'])) {
echo "<td class='bg-warning'>" . $row['lastlogon'] . "</td>";
} else {
echo "<td class='bg-success'>" . $row['lastlogon'] . "</td>";
}
echo "<td>" . $row['dn'] . "</td>";
echo "</tr>";
}
?> ?>
</tbody>
<table class='table table-bordered table-hover table-sm' </table>
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="OS" data-sortable="true">OS</th>
<th data-field="Enabled" data-sortable="true">Enabled</th>
<th data-field="LasLogon" data-sortable="true">Last Logon</th>
<th data-field="OU" data-visible="false">OU</th>
</thead>
<tbody>
<!-- Display DATAs -->
<?php
while ($row = mysqli_fetch_array($rs)) {
echo "<tr>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['os']."</td>";
// Change color cell if enabled = False
if($row['enabled']=="False"){
echo "<td class='bg-warning'>".$row['enabled']."</td>";
}else{
echo "<td>".$row['enabled']."</td>";
}
// Change cell color if lastlogon > 1 month
$date1=date_create($row['lastlogon']);
$diff=date_diff($date1,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 30 || !($row['lastlogon']) ){
echo "<td class='bg-warning'>".$row['lastlogon']."</td>";
}else{
echo "<td class='bg-success'>".$row['lastlogon']."</td>";
}
echo "<td>".$row['dn']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>

View File

@@ -1,72 +1,73 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <div class="container-fluid">
<div class="container-fluid"> <div class="row flex-nowrap">
<div class="row flex-nowrap"> <!-- Left NAVBAR -->
<!-- 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;">
<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 -->
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar --> </div>
</div> <!-- Display -->
<!-- Display --> <div class="col py-3">
<div class="col py-3"> <!-- Page Title -->
<!-- Page Title --> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">NESSUS</span></h1>
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">NESSUS</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php
$conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server");
?>
<table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Version</th>
</tr>
</thead>
<tbody>
<!-- Display DATAs -->
<?php <?php
DB_ENTRY02(); while ($row = mysqli_fetch_array($result)) {
$result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server"); echo "<tr>";
echo "<td>".$row['Server']."</td>";
echo "<td class='bg-success'>".$row['EPO']."</td>";
echo "</tr>";
}
?> ?>
</tbody>
<table class='table table-bordered table-hover table-sm' </table>
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Version</th>
</thead>
<tbody>
<!-- Display DATAs -->
<?php
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['Server']."</td>";
echo "<td class='bg-success'>".$row['EPO']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>

View File

@@ -1,118 +1,103 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <div class="container-fluid">
<div class="container-fluid"> <div class="row flex-nowrap">
<div class="row flex-nowrap"> <!-- Left NAVBAR -->
<!-- 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;">
<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 -->
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar --> </div>
</div> <!-- Display -->
<!-- Display --> <div class="col py-3">
<div class="col py-3"> <!-- Page Title -->
<!-- Page Title --> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">GLPI</span></h1>
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">GLPI</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_GLPI(); $conn = DB_GLPI();
$result = $conn->query("SELECT glpi_computers.name, glpi_operatingsystems.name as OS,plugin_fields_astreinteqpcfielddropdowns_id as crit, last_contact, glpi_computers.computertypes_id FROM glpi_computers $result = $conn->query("SELECT glpi_computers.name, glpi_operatingsystems.name as OS,plugin_fields_astreinteqpcfielddropdowns_id as crit, last_contact, glpi_computers.computertypes_id FROM glpi_computers
left join glpi_items_operatingsystems on glpi_computers.id = glpi_items_operatingsystems.items_id left join glpi_items_operatingsystems on glpi_computers.id = glpi_items_operatingsystems.items_id
left join glpi_operatingsystems on glpi_operatingsystems.id = glpi_items_operatingsystems.operatingsystems_id left join glpi_operatingsystems on glpi_operatingsystems.id = glpi_items_operatingsystems.operatingsystems_id
left join glpi_plugin_fields_computerdatasupps on glpi_plugin_fields_computerdatasupps.items_id = glpi_computers.id left join glpi_plugin_fields_computerdatasupps on glpi_plugin_fields_computerdatasupps.items_id = glpi_computers.id
LEFT JOIN glpi_plugin_fusioninventory_agents ON computers_id = glpi_computers.id LEFT JOIN glpi_plugin_fusioninventory_agents ON computers_id = glpi_computers.id
WHERE glpi_computers.entities_id = 6 AND glpi_computers.is_deleted = 0 AND glpi_computers.states_ID in(2,26) AND glpi_computers.computertypes_id in(7,19,6,2) and glpi_computers.name <> ''"); WHERE glpi_computers.entities_id = 6 AND glpi_computers.is_deleted = 0 AND glpi_computers.states_ID in(2,26) AND glpi_computers.computertypes_id in(7,19,6,2) and glpi_computers.name <> ''");
?> ?>
<table class='table table-bordered table-hover table-sm' <table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true" data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
> >
<thead> <thead>
<th data-field="Name" data-sortable="true">Name</th> <tr>
<th data-field="Type" data-sortable="true">Type</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="Criticity" data-sortable="true">Criticity</th> <th data-field="Type" data-sortable="true">Type</th>
<th data-field="Inventory" data-sortable="true">Last F.I Inventory</th> <th data-field="Criticity" data-sortable="true">Criticity</th>
</thead> <th data-field="Inventory" data-sortable="true">Last F.I Inventory</th>
<tbody> </tr>
<!-- Display DATAs --> </thead>
<?php <tbody>
while ($row = mysqli_fetch_array($result)) { <!-- Display DATAs -->
echo "<tr>"; <?php
echo "<td>".$row['name']."</td>"; while ($row = mysqli_fetch_array($result)) {
switch ($row['computertypes_id']) { echo "<tr>";
case 7: echo "<td>".$row['name']."</td>";
echo "<td>Serveur</td>"; echo match ($row['computertypes_id']) {
break; 7 => "<td>Serveur</td>",
case 19: 19 => "<td>VM</td>",
echo "<td>VM</td>"; 6 => "<td>Portable</td>",
break; 2 => "<td>PC</td>",
case 6: default => "<td></td>",
echo "<td>Portable</td>"; };
break; echo match ($row['crit']) {
case 2: 1 => "<td>Silver</td>",
echo "<td>PC</td>"; 2 => "<td>Gold</td>",
break; 3 => "<td>Bronze</td>",
default: default => "<td></td>",
echo "<td></td>"; };
}
switch ($row['crit']) {
case 1:
echo "<td>Silver</td>";
break;
case 2:
echo "<td>Gold</td>";
break;
case 3:
echo "<td>Bronze</td>";
break;
default:
echo "<td></td>";
}
if($row['last_contact']){ if($row['last_contact']){
$fi=date_create($row['last_contact']); $fi=date_create($row['last_contact']);
$diff=date_diff($fi,date_create(date("Y-m-d"))); $diff=date_diff($fi,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){ if($diff->format("%R%a") > 7){
echo "<td class='bg-warning'>".$row['last_contact']."</td>"; echo "<td class='bg-warning'>".$row['last_contact']."</td>";
}else{ }else{
echo "<td class='bg-success'>".$row['last_contact']."</td>"; echo "<td class='bg-success'>".$row['last_contact']."</td>";
}
}else{echo "<td></td>";}
echo "</tr>";
} }
?> }else{echo "<td></td>";}
</tbody> echo "</tr>";
</table> }
?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>

View File

@@ -1,82 +1,84 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar -->
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">NetBackup</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">NetBackup</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php
$conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where nbu = 'Y' order by server");
?>
<table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="Last Backup" data-sortable="true">Last Backup</th>
</tr>
</thead>
<tbody>
<!-- Display DATAs -->
<?php <?php
DB_ENTRY02(); while ($row = mysqli_fetch_array($result)) {
$result = $conn->query("SELECT * FROM GlobalCrossover where nbu = 'Y' order by server"); echo "<tr>";
?> echo "<td>".$row['Server']."</td>";
$lu=date_create($row['NBUlu']);
<table class='table table-bordered table-hover table-sm' $diff=date_diff($lu,date_create(date("Y-m-d")));
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" if($diff->format("%R%a") > 7){
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true" echo "<td class='bg-warning'>".$row['NBUlu']."</td>";
> }else{
<thead> if($diff->format("%R%a") > 15 || $row['NBUlu'] == ''){
<th data-field="Name" data-sortable="true">Name</th> echo "<td class='bg-danger'>".$row['NBUlu']."</td>";
<th data-field="Last Backup" data-sortable="true">Last Backup</th> } else {
</thead> echo "<td class='bg-success'>".$row['NBUlu']."</td>";
<tbody>
<!-- Display DATAs -->
<?php
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['Server']."</td>";
$lu=date_create($row['NBUlu']);
$diff=date_diff($lu,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "<td class='bg-warning'>".$row['NBUlu']."</td>";
}else{
if($diff->format("%R%a") > 15 || $row['NBUlu'] == ''){
echo "<td class='bg-danger'>".$row['NBUlu']."</td>";
} else {
echo "<td class='bg-success'>".$row['NBUlu']."</td>";
}
}
echo "</tr>";
} }
?> }
</tbody> echo "</tr>";
</table> }
?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>

View File

@@ -1,72 +1,73 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <div class="container-fluid">
<div class="container-fluid"> <div class="row flex-nowrap">
<div class="row flex-nowrap"> <!-- Left NAVBAR -->
<!-- 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;">
<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 -->
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar --> </div>
</div> <!-- Display -->
<!-- Display --> <div class="col py-3">
<div class="col py-3"> <!-- Page Title -->
<!-- Page Title --> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">NESSUS</span></h1>
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">NESSUS</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php
$conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server");
?>
<table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Version</th>
</tr>
</thead>
<tbody>
<!-- Display DATAs -->
<?php <?php
DB_ENTRY02(); while ($row = mysqli_fetch_array($result)) {
$result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server"); echo "<tr>";
echo "<td>".$row['Server']."</td>";
echo "<td class='bg-success'>".$row['EPO']."</td>";
echo "</tr>";
}
?> ?>
</tbody>
<table class='table table-bordered table-hover table-sm' </table>
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Version</th>
</thead>
<tbody>
<!-- Display DATAs -->
<?php
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['Server']."</td>";
echo "<td class='bg-success'>".$row['EPO']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>

View File

@@ -1,78 +1,79 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <div class="container-fluid">
<div class="container-fluid"> <div class="row flex-nowrap">
<div class="row flex-nowrap"> <!-- Left NAVBAR -->
<!-- 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;">
<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 -->
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar --> </div>
</div> <!-- Display -->
<!-- Display --> <div class="col py-3">
<div class="col py-3"> <!-- Page Title -->
<!-- Page Title --> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SentinelOne</span></h1>
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SentinelOne</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php
$conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where S1 like '%.%' order by server");
?>
<table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Last Seen</th>
</tr>
</thead>
<tbody>
<!-- Display DATAs -->
<?php <?php
DB_ENTRY02(); while ($row = mysqli_fetch_array($result)) {
$result = $conn->query("SELECT * FROM GlobalCrossover where S1 like '%.%' order by server"); echo "<tr>";
echo "<td>".$row['Server']."</td>";
$lu=date_create($row['S1lu']);
$diff=date_diff($lu,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "<td class='bg-warning'>".$row['S1lu']."</td>";
}else{
echo "<td class='bg-success'>".$row['S1lu']."</td>";
}
echo "</tr>";
}
?> ?>
</tbody>
<table class='table table-bordered table-hover table-sm' </table>
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
>
<thead>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Last Seen</th>
</thead>
<tbody>
<!-- Display DATAs -->
<?php
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['Server']."</td>";
$lu=date_create($row['S1lu']);
$diff=date_diff($lu,date_create(date("Y-m-d")));
if($diff->format("%R%a") > 7){
echo "<td class='bg-warning'>".$row['S1lu']."</td>";
}else{
echo "<td class='bg-success'>".$row['S1lu']."</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>

View File

@@ -1,84 +1,86 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title --> <!-- Page Title -->
<title>Web Infra Reports</title> <title>Web Infra Reports</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png"> <link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery --> <!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script> <script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css"> <link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<script src="/js/bootstrap.bundle.min.js"></script> <script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables --> <!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css"> <link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script> <script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script> <script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script> <script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script> <script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script> <script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head> </head>
<body class="bg-light text-dark> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions --> <?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar -->
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SCCM</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SCCM</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_SCCM(); $conn = DB_SCCM();
$sql = "SELECT name0,agenttime $sql = "SELECT name0,agenttime
FROM v_GS_SYSTEM FROM v_GS_SYSTEM
left join v_agentdiscoveries on v_GS_SYSTEM.resourceID = v_agentdiscoveries.resourceID left join v_agentdiscoveries on v_GS_SYSTEM.resourceID = v_agentdiscoveries.resourceID
where agentname = 'Heartbeat Discovery' where agentname = 'Heartbeat Discovery'
order by name0"; order by name0";
$rs=odbc_exec($conn,$sql); $rs=odbc_exec($conn,$sql);
?> ?>
<table class='table table-bordered table-hover table-sm' <table class='table table-bordered table-hover table-sm'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true" data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="true"
> >
<thead> <thead>
<th data-field="Name" data-sortable="true">Name</th> <tr>
<th data-field="last contact" data-sortable="true">Last Contact</th> <th data-field="Name" data-sortable="true">Name</th>
</thead> <th data-field="last contact" data-sortable="true">Last Contact</th>
<tbody> </tr>
<!-- Display DATAs --> </thead>
<?php <tbody>
while ($row = odbc_fetch_array($rs)) { <!-- Display DATAs -->
echo "<tr>"; <?php
echo "<td>".$row['name0']."</td>"; while ($row = odbc_fetch_array($rs)) {
// Change cell color if lastcontact > 7 days echo "<tr>";
$date1=date_create($row['agenttime']); echo "<td>".$row['name0']."</td>";
$diff=date_diff($date1,date_create(date("Y-m-d"))); // Change cell color if lastcontact > 7 days
if($diff->format("%R%a") > 7){ $date1=date_create($row['agenttime']);
echo "<td class='bg-warning'>".$row['agenttime']."</td>"; $diff=date_diff($date1,date_create(date("Y-m-d")));
}else{ if($diff->format("%R%a") > 7){
echo "<td class='bg-success'>".$row['agenttime']."</td>"; echo "<td class='bg-warning'>".$row['agenttime']."</td>";
} }else{
echo "</tr>"; echo "<td class='bg-success'>".$row['agenttime']."</td>";
} }
?> echo "</tr>";
</tbody> }
</table> ?>
</tbody>
</table>
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>

1
health.html Normal file
View File

@@ -0,0 +1 @@
OK

View File

@@ -1,7 +1,7 @@
<?php <?php
include $_SERVER['DOCUMENT_ROOT']."/include/constants.inc.php"; include $_SERVER['DOCUMENT_ROOT']."/include/constants.inc.php";
include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.inc.php"; include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.inc.php";
include $_SERVER['DOCUMENT_ROOT']."/include/function.inc.php"; include $_SERVER['DOCUMENT_ROOT']."/include/function.inc.php";
include $_SERVER['DOCUMENT_ROOT']."/include/modal_wait.html"; include $_SERVER['DOCUMENT_ROOT']."/include/modal_wait.html";
?>

View File

@@ -1,15 +0,0 @@
<?php
//CONSTANT
$BaseUrl = "http://".$_SERVER['SERVER_NAME'];
$root = $_SERVER['DOCUMENT_ROOT'];
$bdnuss = "http://web-bdnuss-sys-dev.appliarmony.net";
$wsUrl = "http://wsinfra.appliarmony.net";
//Servers
$dcArmony = "dun-dom-s1dcb";
$dcADArmony = "dun-dcp-r02";
$uxDNS = "dun-com-uxdns01";
$sSCOM = "dun-prd-x1scom";
$sVMM = "dun-sup-s1vmmsv";
?>

View File

@@ -3,6 +3,3 @@
$BaseUrl = "http://".$_SERVER['SERVER_NAME']; $BaseUrl = "http://".$_SERVER['SERVER_NAME'];
$root = $_SERVER['DOCUMENT_ROOT']; $root = $_SERVER['DOCUMENT_ROOT'];
$bdnuss = "http://web-bdnuss-sys-dev.appliarmony.net"; $bdnuss = "http://web-bdnuss-sys-dev.appliarmony.net";
?>

View File

@@ -1,189 +0,0 @@
<?php
//Web-Self-Infra sur DUN-PRD-R1SCOM\OPS
function Invoke_WebSelfInfra($request)
{
$user = "Scom-Write";
$pwd = "Grant@ccess";
$server = "DUN-PRD-R1SCOM.armony.net\OPS";
$database = "web-self-infra";
$conn = odbc_connect("Driver={SQL Server};Server=$server;Database=$database;", $user, $pwd);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = odbc_exec($conn, $request);
if (instr(strtoupper($request), "SELECT")) {
while ($row = odbc_fetch_array($rs)) {
$answer[] = $row;
}
}
if (isset($answer)) {
return $answer;
}
}
function Invoke_SCOMInfra($request)
{
$user = "Scom-Write";
$pwd = "Grant@ccess";
$server = "DUN-PRD-R1SCOM.armony.net\OPS";
$database = "infra";
$conn = odbc_connect("Driver={SQL Server};Server=$server;Database=$database;", $user, $pwd);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = odbc_exec($conn, $request);
if (instr(strtoupper($request), "SELECT")) {
while ($row = odbc_fetch_array($rs)) {
$answer[] = $row;
}
}
if (isset($answer)) {
return $answer;
}
}
//MySQL sur DUN-SUP-ENTRY01
function Invoke_Entry01($request)
{
$user = "infra";
$pwd = "infra";
$server = "dun-sup-entry01:3306";
$database = "infra";
$conn = new mysqli($server, $user, $pwd, $database);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = $conn->query($request);
while ($row = mysqli_fetch_array($rs)) {
$answer[] = $row;
}
if (isset($answer)) {
return $answer;
}
}
// MySQL web-infra-tools sur DUN-SUP-S2ENTRY
function Invoke_WebInfraTools($request)
{
$user = "admin";
$pwd = "Arth3m1s&*0";
$server = "dun-sup-s2entry.armony.net:3306";
$database = "webinfratools";
$conn = new mysqli($server, $user, $pwd, $database);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = $conn->query($request);
while ($row = mysqli_fetch_array($rs)) {
$answer[] = $row;
}
if (isset($answer)) {
return $answer;
}
}
// MySQL web-infra-tools sur DUN-SUP-S2ENTRY
function Invoke_WebInfraReports($request)
{
$user = "admin";
$pwd = "Arth3m1s&*0";
$server = "dun-sup-s2entry.armony.net:3306";
$database = "web-infra-reports";
$conn = new mysqli($server, $user, $pwd, $database);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = $conn->query($request);
while ($row = mysqli_fetch_array($rs)) {
$answer[] = $row;
}
if (isset($answer)) {
return $answer;
}
}
//INFRA sur DUN-PRD-R1MSSQL\PRD
function Invoke_Infra($request)
{
error_reporting(E_ALL ^ E_WARNING);
$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);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = odbc_exec($conn, $request);
if (instr(strtoupper($request), "SELECT")) {
while ($row = odbc_fetch_array($rs)) {
$answer[] = $row;
}
}
if (isset($answer)) {
return $answer;
} else {
if ($rs) {
return "OK";
} else {
error_reporting(E_ALL);
return "ERROR : " . odbc_errormsg($conn);
}
}
}
// aixcmdb
function Invoke_aixcmdb($request)
{
error_reporting(E_ALL ^ E_WARNING);
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};" .
"DATABASE=AIXCMDB; " .
"HOSTNAME=db2_aixcmdb.appliarmony.net;" .
"PORT=50000; " .
"PROTOCOL=TCPIP; " .
"UID=aixcmdb;" .
"AUTHENTICATION=SERVER;" .
"PWD=aixcmdb;";
$conn = odbc_connect($conn_string, "", "");
if (!($conn)) {
echo "Pas de connexion";
}
$rs = odbc_exec($conn, $request);
if (instr(strtoupper($request), "SELECT")) {
while ($row = odbc_fetch_array($rs)) {
$answer[] = $row;
}
}
if (isset($answer)) {
return $answer;
} else {
if ($rs) {
return "OK";
} else {
error_reporting(E_ALL);
return "ERROR : " . odbc_errormsg($conn);
}
}
}
function Invoke_GLPI($request)
{
$user="glpi_lect_seule";
$pwd="glpi_lect_seule";
$server="srvv-n4glpi-aim.process.dkm";
$server="mys_glpi_prod.appliarmony.net";
$database="glpi";
$conn = new mysqli($server, $user, $pwd, $database);
if (!($conn)) {
echo "Pas de connexion";
}
$rs = $conn->query($request);
while ($row = mysqli_fetch_array($rs)) {
$answer[] = $row;
}
if (isset($answer)) {
return $answer;
}
}

View File

@@ -1,41 +0,0 @@
<?php
function DB_SCCM(){
$user = "infra";
$pwd = "infra";
global $conn ;
$conn = odbc_connect("Driver={SQL Server};Server=DUN-SMS-SRV01;Database=CM_SV1;", $user, $pwd);
if(!($conn)){echo "Pas de connexion";}
}
function DB_GLPI() {
$username="glpi_lect_seule";
$password="glpi_lect_seule";
$dbserver="mys_glpi_prod.appliarmony.net";
$database="glpi";
global $conn ;
$conn = new mysqli($dbserver,$username,$password,$database);
}
function DB_ENTRY01() {
$username="infra";
$password="infra";
$dbserver="dun-sup-entry01.armony.net";
$database="infra";
global $conn ;
$conn = new mysqli($dbserver,$username,$password,$database);
}
function DB_ENTRY02() {
$username="admin";
$password="Arth3m1s&*0";
$dbserver="dun-sup-s2entry.armony.net";
$database="web-infra-reports";
global $conn ;
$conn = new mysqli($dbserver,$username,$password,$database);
}

View File

@@ -1,37 +0,0 @@
<?php
function instr($string, $search){
if (strpos($string, $search) !== false) {
return true;
} else {
return false;
}
}
function PostJson($url, $content){
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$retour = curl_exec($curl);
curl_close($curl);
return $retour;
}
function Read_HTML($url){
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$retour = curl_exec($curl);
curl_close($curl);
return $retour;
}
if($_SERVER['REMOTE_USER'] != ""){$source = explode("\\",$_SERVER['REMOTE_USER'])[1];}
?>

View File

@@ -1,15 +0,0 @@
<div class="preloader">
<br>
<h1><span style="color: white"><b>Loading Data</b></h1>
<h3><span style="color: white"><b>Please wait ...</b></h3>
<div class="loader">
<div class="loader-outter"></div>
<div class="loader-inner"></div>
<div class="indicator">
<svg width="16px" height="12px">
<polyline id="back" points="1 6 4 6 6 11 10 1 12 6 15 6"></polyline>
<polyline id="front" points="1 6 4 6 6 11 10 1 12 6 15 6"></polyline>
</svg>
</div>
</div>
</div>

46
include/test.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
// Temporarily enable all error reporting to catch details from odbc_connect
// error_reporting(E_ALL); // Uncomment this line if you still don't get enough info
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER - F_DB2_clidriver};" .
"DATABASE=AIXCMDB; " .
"HOSTNAME=db2_aixcmdb.appliarmony.net;" .
"PORT=50000; " .
"PROTOCOL=TCPIP; " .
"UID=aixcmdb;" .
"AUTHENTICATION=SERVER;" .
"PWD=aixcmdb;";
$conn = odbc_connect($conn_string, "", "");
if (!$conn) {
// --- IMPORTANT: Récupérer le message d'erreur ODBC détaillé ---
$error_message = "ODBC Connect Error: " . odbc_errormsg() . " (" . odbc_error() . ")";
echo "Pas de connexion : " . $error_message . "<br>";
// Pour débogage, tu peux aussi loguer cette erreur dans un fichier
// error_log($error_message);
return "ERROR: Could not connect to DB2. Check connection string and ODBC setup."; // Retourne une erreur pour éviter l'appel à odbc_exec
}
$rs = odbc_exec($conn, $request);
// Ton code existant après la connexion
if (strpos(strtoupper($request), "SELECT") !== false) { // strpos est plus robuste que instr ici en PHP
$answer = []; // Initialize array to prevent undefined variable warning
while ($row = odbc_fetch_array($rs)) {
$answer[] = $row;
}
}
if (isset($answer)) {
return $answer;
} else {
if ($rs) {
return "OK";
} else {
// If odbc_exec failed
error_reporting(E_ALL); // Re-enable for this specific error if needed
return "ERROR : " . odbc_errormsg($conn);
}
}

View File

@@ -25,8 +25,7 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- Left NAVBAR -->
@@ -40,7 +39,7 @@
<!-- Main content --> <!-- Main content -->
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$sql = $conn->query("SELECT count(*) as w2k3 FROM globalcrossover where os like '%2003%' and dpt = 'INFRA'"); $w2k3 = mysqli_fetch_array($sql)['w2k3']; $sql = $conn->query("SELECT count(*) as w2k3 FROM globalcrossover where os like '%2003%' and dpt = 'INFRA'"); $w2k3 = mysqli_fetch_array($sql)['w2k3'];
$sql = $conn->query("SELECT count(*) as w2k8 FROM globalcrossover where os like '%2008%' and dpt = 'INFRA'"); $w2k8 = mysqli_fetch_array($sql)['w2k8']; $sql = $conn->query("SELECT count(*) as w2k8 FROM globalcrossover where os like '%2008%' and dpt = 'INFRA'"); $w2k8 = mysqli_fetch_array($sql)['w2k8'];
$sql = $conn->query("SELECT count(*) as w2k12 FROM globalcrossover where os like '%2012%' and dpt = 'INFRA'"); $w2k12 = mysqli_fetch_array($sql)['w2k12']; $sql = $conn->query("SELECT count(*) as w2k12 FROM globalcrossover where os like '%2012%' and dpt = 'INFRA'"); $w2k12 = mysqli_fetch_array($sql)['w2k12'];
@@ -79,7 +78,7 @@
$result = $conn->query("SELECT count(*) as nbADinactive FROM adcomputers WHERE enabled = 'False'"); $result = $conn->query("SELECT count(*) as nbADinactive FROM adcomputers WHERE enabled = 'False'");
$nbADinactive = mysqli_fetch_array($result)['nbADinactive']; $nbADinactive = mysqli_fetch_array($result)['nbADinactive'];
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\AD-Detail.php"><?php echo $nbADactive; ?></b> Devices <small>(<?php echo $nbADinactive; ?> inactifs)</small></a></p> <p class="card-text text-center"><b><a href="/dashboard/AD-Detail.php""><?php echo $nbADactive; ?></b> Devices <small>(<?php echo $nbADinactive; ?> inactifs)</small></a></p>
</div> </div>
</div> </div>
</div> </div>
@@ -89,12 +88,12 @@
<div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> GLPI</h5></div> <div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> GLPI</h5></div>
<div class="card-body"> <div class="card-body">
<?php <?php
DB_GLPI(); $conn = DB_GLPI();
$result = $conn->query("SELECT count(name) as nbglpi FROM glpi_computers WHERE entities_id = 6 AND is_deleted = 0 AND states_ID = 2 AND computertypes_id in(7,19) and name <> ''"); $result = $conn->query("SELECT count(name) as nbglpi FROM glpi_computers WHERE entities_id = 6 AND is_deleted = 0 AND states_ID = 2 AND computertypes_id in(7,19) and name <> ''");
$nbglpi = mysqli_fetch_array($result)['nbglpi']; $nbglpi = mysqli_fetch_array($result)['nbglpi'];
mysqli_close($conn); mysqli_close($conn);
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\GLPI-detail.php"><?php echo $nbglpi; ?></b> Devices</a></p> <p class="card-text text-center"><b><a href="/dashboard/GLPI-Detail.php"><?php echo $nbglpi; ?></b> Devices</a></p>
</div> </div>
</div> </div>
</div> </div>
@@ -104,12 +103,12 @@
<div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> SCCM</h5></div> <div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> SCCM</h5></div>
<div class="card-body"> <div class="card-body">
<?php <?php
DB_SCCM(); $conn = DB_SCCM();
$sql = 'SELECT count(*) as nbsccm FROM dbo.v_GS_COMPUTER_SYSTEM'; $sql = 'SELECT count(*) as nbsccm FROM dbo.v_GS_COMPUTER_SYSTEM';
$rs=odbc_exec($conn,$sql); $rs=odbc_exec($conn,$sql);
$nbsccm = odbc_result($rs,"nbsccm"); $nbsccm = odbc_result($rs,"nbsccm");
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\SCCM-detail.php"><?php echo $nbsccm; ?></b> Agents</a></p> <p class="card-text text-center"><b><a href="/dashboard/SCCM-Detail.php"><?php echo $nbsccm; ?></b> Agents</a></p>
</div> </div>
</div> </div>
</div> </div>
@@ -119,11 +118,11 @@
<div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> NESSUS</h5></div> <div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> NESSUS</h5></div>
<div class="card-body"> <div class="card-body">
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$result = $conn->query("SELECT count(*) as nbnessus FROM GlobalCrossover where epo like '%.%'"); $result = $conn->query("SELECT count(*) as nbnessus FROM GlobalCrossover where epo like '%.%'");
$nbnessus = mysqli_fetch_array($result)['nbnessus']; $nbnessus = mysqli_fetch_array($result)['nbnessus'];
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\Nessus-detail.php"><?php echo $nbnessus; ?></b> Agents</a></p> <p class="card-text text-center"><b><a href="/dashboard/Nessus-Detail.php"><?php echo $nbnessus; ?></b> Agents</a></p>
</div> </div>
</div> </div>
</div> </div>
@@ -136,7 +135,7 @@
$result = $conn->query("SELECT count(*) as nbS1 FROM GlobalCrossover where S1 like '%.%'"); $result = $conn->query("SELECT count(*) as nbS1 FROM GlobalCrossover where S1 like '%.%'");
$nbS1 = mysqli_fetch_array($result)['nbS1']; $nbS1 = mysqli_fetch_array($result)['nbS1'];
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\S1-detail.php"><?php echo $nbS1; ?></b> Agents</a></p> <p class="card-text text-center"><b><a href="/dashboard/S1-Detail.php"><?php echo $nbS1; ?></b> Agents</a></p>
</div> </div>
</div> </div>
</div> </div>
@@ -146,12 +145,12 @@
<div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> NetBackup</h5></div> <div class="card-header text-dark"><h5><i class="fs-4 bi-pc text-primary"></i> NetBackup</h5></div>
<div class="card-body"> <div class="card-body">
<?php <?php
DB_ENTRY01(); $conn = DB_ENTRY01();
$result = $conn->query("SELECT count(distinct server) as nbnbu FROM nb_jobs_full"); $result = $conn->query("SELECT count(distinct server) as nbnbu FROM nb_jobs_full");
$nbnbu = mysqli_fetch_array($result)['nbnbu']; $nbnbu = mysqli_fetch_array($result)['nbnbu'];
mysqli_close($conn); mysqli_close($conn);
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\NBU-detail.php"><?php echo $nbnbu; ?></b> Clients</a></p> <p class="card-text text-center"><b><a href="/dashboard/NBU-Detail.php"><?php echo $nbnbu; ?></b> Clients</a></p>
</div> </div>
</div> </div>
</div> </div>
@@ -197,14 +196,13 @@
<!-- End of main content --> <!-- End of main content -->
</div> </div>
</div> </div>
</div>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</body> </body>
<script> <script>
var dataSV = document.getElementById("dataSVI").innerHTML.split(","); let dataSV = document.getElementById("dataSVI").innerHTML.split(",");
var labelsSV = ['2008','2012','2016','2019','2022']; let labelsSV = ['2008', '2012', '2016', '2019', '2022'];
new Chart("ChartServer", { new Chart("ChartServer", {
type: 'doughnut', type: 'doughnut',
data: { data: {
labels: labelsSV, labels: labelsSV,
@@ -215,9 +213,9 @@ new Chart("ChartServer", {
} }
}); });
var dataSVA = document.getElementById("dataSVA").innerHTML.split(","); let dataSVA = document.getElementById("dataSVA").innerHTML.split(",");
var labelsSVA = ['2008','2012','2016','2019','2022']; let labelsSVA = ['2008', '2012', '2016', '2019', '2022'];
new Chart("ChartServerA", { new Chart("ChartServerA", {
type: 'doughnut', type: 'doughnut',
data: { data: {
labels: labelsSVA, labels: labelsSVA,
@@ -228,9 +226,9 @@ new Chart("ChartServerA", {
} }
}); });
var dataLI = document.getElementById("dataLI").innerHTML.split(","); let dataLI = document.getElementById("dataLI").innerHTML.split(",");
var labelsLI = ['Linux','AIX']; let labelsLI = ['Linux', 'AIX'];
new Chart("ChartLinux", { new Chart("ChartLinux", {
type: 'doughnut', type: 'doughnut',
data: { data: {
labels: labelsLI, labels: labelsLI,
@@ -241,9 +239,9 @@ new Chart("ChartLinux", {
} }
}); });
var dataType = document.getElementById("dataType").innerHTML.split(","); let dataType = document.getElementById("dataType").innerHTML.split(",");
var labelsType = ['Physical','Virtual']; let labelsType = ['Physical', 'Virtual'];
new Chart("ChartType", { new Chart("ChartType", {
type: 'doughnut', type: 'doughnut',
data: { data: {
labels: labelsType, labels: labelsType,

10909
js/jquery-3.6.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,6 @@
<!--
<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"> <link rel="stylesheet" href="/css/autocomplete.css">
<script src="/js/jqueryui.js"></script> <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"> <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"> <a href="/" class="d-flex align-items-center pb-3 mb-md-0 me-md-auto text-white text-decoration-none">
@@ -130,23 +127,23 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$("#searchServer").autocomplete({ $("#searchServer").autocomplete({
source: "/search_servers.php", source: "/Inventory/search_servers.php",
minLength: 2, minLength: 2,
appendTo: "body", appendTo: "body",
position: { my: "left top", at: "left bottom-10" }, position: { my: "left top", at: "left bottom-10" },
select: function(event, ui) { select: function(event, ui) {
window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(ui.item.value); window.location.href = "/Inventory/server-detail.php?s=" + encodeURIComponent(ui.item.value);
} }
}); });
$("#searchServer").keypress(function(event) { $("#searchServer").keypress(function(event) {
if (event.which == 13) { if (event.which == 13) {
event.preventDefault(); event.preventDefault();
var selectedServer = $(this).val().trim(); var selectedServer = $(this).val().trim();
if (selectedServer !== "") { if (selectedServer !== "") {
window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(selectedServer); window.location.href = "/inventory/server-detail.php?s=" + encodeURIComponent(selectedServer);
}
} }
}); }
});
}); });
</script> </script>

View File

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

View File

@@ -1,168 +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 // DATA
$answers = Invoke_GLPI("SELECT a.name as server,left(d.name,4) as 'type',
b.arretprogrammezeroonefield as january,
b.arretprogrammezerotwofield as february,
b.arretprogrammezerothreefield as march,
b.arretprogrammezerofourfield as april,
b.arretprogrammezerofivefield as may,
b.arretprogrammezerosixfield as june,
b.arretprogrammezerosevenfield as july,
b.arretprogrammezeroeightfield as august,
b.arretprogrammezeroninefield as september,
b.arretprogrammeonezerofield as october,
b.arretprogrammeoneonefield as november,
b.arretprogrammeonetwofield as december
from glpi_computers a
left join glpi_plugin_fields_computercreneaumaintenances b on b.items_id = a.id
left join glpi_plugin_fields_computerdatasupps c on c.items_id = a.id
left join glpi_plugin_fields_typearretfielddropdowns d on d.id = c.plugin_fields_typearretfielddropdowns_id
where a.entities_id = 6 and a.name is not null and d.name is not null and b.arretprogrammezeroonefield is not null
order by Server asc");
?>
<!-- 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%;">Rollup Calendar</h6></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 style="zoom:80%">
<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="Server" data-sortable="true">Server</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="January" data-sortable="true">January</th>
<th data-field="February" data-sortable="true">February</th>
<th data-field="March" data-sortable="true">March</th>
<th data-field="April" data-sortable="true">April</th>
<th data-field="May" data-sortable="true">May</th>
<th data-field="June" data-sortable="true">June</th>
<th data-field="July" data-sortable="true">July</th>
<th data-field="August" data-sortable="true">August</th>
<th data-field="September" data-sortable="true">September</th>
<th data-field="October" data-sortable="true">October</th>
<th data-field="November" data-sortable="true">November</th>
<th data-field="December" data-sortable="true">December</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($answers as $answer) {
echo "<td class='text-nowrap'><b>".$answer['server']."</b></td>";
echo "<td>".$answer['type']."</td>";
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['january']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['february']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['march']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['april']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['may']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['june']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['july']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['august']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['september']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['october']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['november']."</small></td>")));
echo "<td class='text-nowrap'><small>".str_replace(':30:00',':30',(str_replace(':00:00',':00',$answer['december']."</small></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);
</script>
</SCRIPT>

View File

@@ -29,87 +29,91 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<?php // DATA <?php // DATA
$folders = Invoke_Infra("SELECT * FROM FLS_and_PRS where typ in('PROJET','TEAMS') order by [server], folder"); $folders = Invoke_Infra("SELECT * FROM FLS_and_PRS where typ in('PROJET','TEAMS') order by [server], folder");
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Project and Team folders <small><small>(<?php echo count($folders); ?> entries) </small></small><br><h6>Updated every day at 07:00:00</h6></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Project and Team folders <small><small>(<?php echo count($folders); ?> entries)</small></small></span></h1>
<h6>Updated every day at 07:00:00</h6>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
<!-- MODAL WAIT --> <!-- 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 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-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title mb-1 text-dark text-uppercase"> <h4 class="modal-title mb-1 text-dark text-uppercase text-center">
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center> <i class="bi bi-hourglass-split"></i><br> Work in progress ...
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div> <div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
</div> </div>
</div>
</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="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if($answer['acl'] == "" || $answer['users'] == 0){
echo "<tr class='table-warning'>";
}else{
echo "<tr>";
}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo "<td>".$answer['typ']."</td>";
echo "<td>".$answer['acl']."</td>";
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td>".$answer['users']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content --> <!-- 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 -->
<tr>
<th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th>
<th data-field="ACL" data-sortable="true">ACL</th>
<th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th>
</tr>
</thead>
<tbody> <!-- Body -->
<?php
foreach ($folders as $answer) {
if($answer['acl'] == "" || $answer['users'] == 0){
echo "<tr class='table-warning'>";
}else{
echo "<tr>";
}
echo "<td class='text-nowrap'>".$answer['server']."</td>";
echo "<td>".$answer['folder']."</td>";
echo "<td>".$answer['typ']."</td>";
echo "<td>".$answer['acl']."</td>";
echo "<td>".$answer['quota']."</td>";
echo "<td>".$answer['size']."</td>";
echo "<td>".$answer['users']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<br>
</div>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
</div>
</body> </body>
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ $('#t1').DataTable({
scrollY: '50vh', scrollY: '50vh',
@@ -119,22 +123,17 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script> </script>
</SCRIPT>

View File

@@ -28,74 +28,74 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?>
<?php // DATA <?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') and hostname <> '' 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"); $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"); $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"); $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");
$lok = "<div class='row'>";$lko = "<div class='row'>";$lcount=0; $lok = "<div class='row'>";$lko = "<div class='row'>";$lcount=0;
foreach($linux as $s){ foreach($linux as $s){
if($s['HBTIME'] < date('Y-m-d H:i:s', strtotime(' -11 minutes '))){ if($s['HBTIME'] < date('Y-m-d H:i:s', strtotime(' -11 minutes '))){
$lko .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['HOSTNAME'])." since ".explode(".",$s['PREVTIME'])[0]."</span></div>"; $lko .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['HOSTNAME'])." since ".explode(".",$s['PREVTIME'])[0]."</span></div>";
$lcount++; $lcount++;
}else{ }else{
$lok .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['HOSTNAME']." ")."</span></div>"; $lok .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['HOSTNAME']." ")."</span></div>";
}
} }
if($lcount){$color = "DarkOrange";$msg = $lcount." issues";}else{$color = "green";$msg = "OK";} }
$aok = "<div class='row'>";$ako = "<div class='row'>";$acount=0; if($lcount){$color = "DarkOrange";$msg = $lcount." issues";}else{$color = "green";$msg = "OK";}
foreach($aix as $s){ $aok = "<div class='row'>";$ako = "<div class='row'>";$acount=0;
if($s['HBTIME'] < date('Y-m-d H:i:s', strtotime(' -11 minutes '))){ foreach($aix as $s){
$ako .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['HOSTNAME'])." since".explode(".",$s['PREVTIME'])[0]."</span></div>"; if($s['HBTIME'] < date('Y-m-d H:i:s', strtotime(' -11 minutes '))){
$acount++; $ako .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['HOSTNAME'])." since".explode(".",$s['PREVTIME'])[0]."</span></div>";
}else{ $acount++;
$aok .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['HOSTNAME']." ")."</span></div>"; }else{
} $aok .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['HOSTNAME']." ")."</span></div>";
} }
$ook = "<div class='row'>";$oko = "<div class='row'>";$ocount=0; }
foreach($other as $s){ $ook = "<div class='row'>";$oko = "<div class='row'>";$ocount=0;
if($s['HBTIME'] < date('Y-m-d H:i:s', strtotime(' -11 minutes '))){ foreach($other as $s){
$oko .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['HOSTNAME'])." since".explode(".",$s['PREVTIME'])[0]."</span></div>"; if($s['HBTIME'] < date('Y-m-d H:i:s', strtotime(' -11 minutes '))){
$ocount++; $oko .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['HOSTNAME'])." since".explode(".",$s['PREVTIME'])[0]."</span></div>";
}else{ $ocount++;
$ook .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['HOSTNAME']." ")."</span></div>"; }else{
} $ook .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['HOSTNAME']." ")."</span></div>";
} }
$wok = "<div class='row'>";$wko = "<div class='row'>";$wcount=0; }
foreach($windows as $s){ $wok = "<div class='row'>";$wko = "<div class='row'>";$wcount=0;
if($s['heartbeat'] < date('Y-m-d H:i:s', strtotime(' -16 minutes '))){ foreach($windows as $s){
$wko .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['hostname'])." since ".explode(".",$s['heartbeat'])[0]."</span></div>"; if($s['heartbeat'] < date('Y-m-d H:i:s', strtotime(' -16 minutes '))){
$wcount++; $wko .= "<div class='col-6'><span class='badge bg-danger'>".strtoupper($s['hostname'])." since ".explode(".",$s['heartbeat'])[0]."</span></div>";
}else{ $wcount++;
$wok .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['hostname']." ")."</span></div>"; }else{
} $wok .= "<div class='col-2'><span class='badge bg-success'>".strtoupper($s['hostname']." ")."</span></div>";
} }
}
?> ?>
<!-- HTML --> <!-- HTML -->
<div class="container-fluid" id="content"> <div class="container-fluid" id="content">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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"; ?> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">HeartBeat Map for servers NOT in maintenance</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">HeartBeat Map for servers NOT in maintenance</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="container"> <div class="container">
<!-- TABLE --> <!-- TABLE -->
<div> <div>
<div id="accordion"> <div id="accordion">
<?php if($wcount){$color = "DarkOrange";$msg = "<b> --> ".$wcount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?> <?php if($wcount){$color = "DarkOrange";$msg = "<b> --> ".$wcount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?>
<div class="card" style='background-color:<?php echo $color ?>;'> <div class="card" style='background-color:<?php echo $color ?>;'>
<h4 class="card-header"> <h4 class="card-header">
<a class="btn text-white" data-bs-toggle="collapse" href="#windows"><b><h3>Windows : <?php echo count($windows)." Devices ". $msg; ?></h3></b></a> <a class="btn text-white fs-3" data-bs-toggle="collapse" href="#windows"><b>Windows : <?php echo count($windows)." Devices ". $msg; ?></b></a>
</h4> </h4>
</div> </div>
<div id="windows" class="collapse" data-bs-parent="#accordion"> <div id="windows" class="collapse" data-bs-parent="#accordion">
@@ -106,7 +106,7 @@
<?php if($lcount){$color = "DarkOrange";$msg = "<b> --> ".$lcount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?> <?php if($lcount){$color = "DarkOrange";$msg = "<b> --> ".$lcount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?>
<div class="card" style='background-color:<?php echo $color ?>;'> <div class="card" style='background-color:<?php echo $color ?>;'>
<h4 class="card-header"> <h4 class="card-header">
<a class="btn text-white" data-bs-toggle="collapse" href="#linux"><b><h3>Linux : <?php echo count($linux)." Devices ". $msg; ?></h3></b></a> <a class="btn text-white fs-3" data-bs-toggle="collapse" href="#linux"><b>Linux : <?php echo count($linux)." Devices ". $msg; ?></b></a>
</h4> </h4>
</div> </div>
<div id="linux" class="collapse" data-bs-parent="#accordion"> <div id="linux" class="collapse" data-bs-parent="#accordion">
@@ -117,7 +117,7 @@
<?php if($acount){$color = "DarkOrange";$msg = "<b> --> ".$acount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?> <?php if($acount){$color = "DarkOrange";$msg = "<b> --> ".$acount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?>
<div class="card" style='background-color:<?php echo $color ?>;'> <div class="card" style='background-color:<?php echo $color ?>;'>
<h4 class="card-header text-white"> <h4 class="card-header text-white">
<a class="btn text-white" data-bs-toggle="collapse" href="#aix"><b><h3>AIX : <?php echo count($aix)." Devices ". $msg; ?></h3></b></a> <a class="btn text-white fs-3" data-bs-toggle="collapse" href="#aix"><b>AIX : <?php echo count($aix)." Devices ". $msg; ?></b></a>
</h4> </h4>
</div> </div>
<div id="aix" class="collapse" data-bs-parent="#accordion"> <div id="aix" class="collapse" data-bs-parent="#accordion">
@@ -128,7 +128,7 @@
<?php if($ocount){$color = "DarkOrange";$msg = "<b> --> ".$ocount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?> <?php if($ocount){$color = "DarkOrange";$msg = "<b> --> ".$ocount." issue(s)</b>";}else{$color = "green";$msg = "OK";} ?>
<div class="card" style='background-color:<?php echo $color ?>;'> <div class="card" style='background-color:<?php echo $color ?>;'>
<h4 class="card-header text-white"> <h4 class="card-header text-white">
<a class="btn text-white" data-bs-toggle="collapse" href="#other"><b><h3>Other : <?php echo count($other)." Devices ". $msg; ?></h3></b></a> <a class="btn text-white fs-3" data-bs-toggle="collapse" href="#other"><b>Other : <?php echo count($other)." Devices ". $msg; ?></b></a>
</h4> </h4>
</div> </div>
<div id="other" class="collapse" data-bs-parent="#accordion"> <div id="other" class="collapse" data-bs-parent="#accordion">
@@ -148,8 +148,9 @@
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -157,18 +158,18 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</SCRIPT> </SCRIPT>

View File

@@ -44,7 +44,7 @@
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVA & SCU Accounts Attributes <br><h6>Updated every hour</h6></span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">SVA & SCU Accounts Attributes </span></h1><h6>Updated every hour</h6>
<!-- Main content --> <!-- Main content -->
<div class="container-fluid"> <div class="container-fluid">
@@ -69,6 +69,7 @@
<div> <div>
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM"> <table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="VM">
<thead> <!-- Header --> <thead> <!-- Header -->
<tr>
<th data-field='account' data-sortable='true'>Account</th> <th data-field='account' data-sortable='true'>Account</th>
<th data-field='Displayname' data-sortable='true'>Displayname</th> <th data-field='Displayname' data-sortable='true'>Displayname</th>
<th data-field='Uid' data-sortable='true'>Uid</th> <th data-field='Uid' data-sortable='true'>Uid</th>
@@ -79,6 +80,7 @@
<th data-field='GID Number' data-sortable='true'>GID Number</th> <th data-field='GID Number' data-sortable='true'>GID Number</th>
<th data-field='Enabled' data-sortable='true'>Enabled</th> <th data-field='Enabled' data-sortable='true'>Enabled</th>
<th data-field='LastLogon' data-sortable='true'>Last Logon</th> <th data-field='LastLogon' data-sortable='true'>Last Logon</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
@@ -116,8 +118,9 @@
</HTML> </HTML>
<SCRIPT> <SCRIPT>
let table = $('#t1');
$(document).ready(function() { $(document).ready(function() {
$('#t1').DataTable({ table.DataTable({
scrollY: '50vh', scrollY: '50vh',
scrollCollapse: true, scrollCollapse: true,
paging: false, paging: false,
@@ -125,22 +128,16 @@
}); });
$(function () { $(function () {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}); });
function tableresize() { function tableresize() {
var options = $('#t1').bootstrapTable('getOptions'); let options = table.bootstrapTable('getOptions');
options.height= document.getElementById('content').clientHeight-170; options.height= document.getElementById('content').clientHeight-170;
$('#t1').bootstrapTable('refreshOptions',options); table.bootstrapTable('refreshOptions',options);
}; }
window.addEventListener("resize", tableresize); window.addEventListener("resize", tableresize);
</script>
</SCRIPT> </SCRIPT>

View File

@@ -1,24 +0,0 @@
<?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);
}
?>

View File

@@ -1,297 +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>
</head>
<body>
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<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" style="zoom: 80%;">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">TICKETS GLPI <small><small> Infra_Système_DK</small></small></span></h1>
<!-- Main content -->
<?php
DB_GLPI();
$sql = $conn->query("SELECT count(*) as total, max(date_mod) as maxi, min(date_mod) as mini FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6"); $r = mysqli_fetch_array($sql); $Nouveau = $r['total'];$d1=$r['mini'];$f1=$r['maxi'];
$sql = $conn->query("SELECT count(*) as total, max(date_mod) as maxi, min(date_mod) as mini FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 2"); $r = mysqli_fetch_array($sql); $EnCours = $r['total'];$d2=$r['mini'];$f2=$r['maxi'];
$sql = $conn->query("SELECT count(*) as total, max(date_mod) as maxi, min(date_mod) as mini FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 3"); $r = mysqli_fetch_array($sql); $Planifie = $r['total'];$d3=$r['mini'];$f3=$r['maxi'];
$sql = $conn->query("SELECT count(*) as total, max(date_mod) as maxi, min(date_mod) as mini FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 4"); $r = mysqli_fetch_array($sql); $EnAttente = $r['total'];$d4=$r['mini'];$f4=$r['maxi'];
$sql = $conn->query("SELECT count(*) as total, max(date_mod) as maxi, min(date_mod) as mini FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 5"); $r = mysqli_fetch_array($sql); $Resolu = $r['total'];$d5=$r['mini'];$f5=$r['maxi'];
$sql = $conn->query("SELECT count(*) as total, max(date_mod) as maxi, min(date_mod) as mini FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 6"); $r = mysqli_fetch_array($sql); $Clos = $r['total'];$d6=$r['mini'];$f6=$r['maxi'];
$n0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) <= 7")))['total'];
$n7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$n30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) > 30")))['total'];
$ec0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 2 and DATEDIFF(now(),date_creation) <= 7")))['total'];
$ec7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 2 and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$ec30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 2 and DATEDIFF(now(),date_creation) > 30")))['total'];
$p0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 3 and DATEDIFF(now(),date_creation) <= 7")))['total'];
$p7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 3 and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$p30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 3 and DATEDIFF(now(),date_creation) > 30")))['total'];
$ea0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 4 and DATEDIFF(now(),date_creation) <= 7")))['total'];
$ea7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 4 and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$ea30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = 4 and DATEDIFF(now(),date_creation) > 30")))['total'];
$sql = $conn->query(" SELECT count(*) as total, realname, firstname FROM glpi_tickets
left join glpi_tickets_users on glpi_tickets.id = glpi_tickets_users.tickets_id and glpi_tickets_users.type = 2
left join glpi_users on glpi_tickets_users.users_id = glpi_users.id
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and status in (2,3,4)
and glpi_tickets_users.users_id in (SELECT glpi_users.id FROM glpi_groups_users left join glpi_users on users_id = glpi_users.id where glpi_groups_users.groups_id = 13)
group by glpi_tickets_users.users_id, realname
order by total desc");
$repName='';$repTot='';
while($row = mysqli_fetch_array($sql)){
$repName .= $row['firstname'].' '.$row['realname'].',';
$repTot .= $row['total'].',';
}
$repName = substr($repName, 0, -1);
$repTot = substr($repTot, 0, -1);
$sql = $conn->query(" SELECT count(*) as total FROM glpi_tickets
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and status in(2,3,4)");
$r = mysqli_fetch_array($sql); $ec = $r['total'];
?>
<span id="dataC0" class="invisible"><?php echo "$n0,$ec0,$p0,$ea0" ?></span>
<span id="dataC7" class="invisible"><?php echo "$n7,$ec7,$p7,$ea7" ?></span>
<span id="dataC30" class="invisible"><?php echo "$n30,$ec30,$p30,$ea30" ?></span>
<span id="repName" class="invisible"><?php echo "$repName" ?></span>
<span id="repTot" class="invisible"><?php echo "$repTot" ?></span>
<div class="row flex-nowrap text-center">
<div class="col"> <!-- CARTE Nouveaux -->
<div class="card border-danger mb-3">
<div class="card-header">
<h5><i class="fs-4 bi-person-x-fill text-danger"></i> Non Attribué</h5>
</div>
<a href="\tickets\list.php?state=1" class="text-decoration-none" target="_blank">
<div class="card-body">
<h1><span class="badge bg-danger"><?php echo $Nouveau; ?></span></h1>
<h6 class="text-decoration-none text-black-50"><?php echo date("d/m/y", strtotime($d1)) ?> <i class="bi-arrow-right-short "></i> <?php echo date("d/m/y", strtotime($f1)) ?></h6>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE En Cours -->
<div class="card border-info mb-3">
<div class="card-header">
<h5><i class="fs-4 bi-caret-right text-info"></i> En Cours</h5>
</div>
<a href="\tickets\list.php?state=2" class="text-decoration-none" target="_blank">
<div class="card-body">
<h1><span class="badge bg-info"><?php echo $EnCours; ?></span></h1>
<h6 class="text-decoration-none text-black-50"><?php echo date("d/m/y", strtotime($d2)) ?> <i class="bi-arrow-right-short "></i> <?php echo date("d/m/y", strtotime($f2)) ?></h6>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE Planifié -->
<div class="card border-primary mb-3">
<div class="card-header">
<h5><i class="fs-4 bi-calendar-check text-primary"></i> Planifié</h5>
</div>
<a href="\tickets\list.php?state=3" class="text-decoration-none" target="_blank">
<div class="card-body">
<h1><span class="badge bg-primary"><?php echo $Planifie; ?></span></h1>
<h6 class="text-decoration-none text-black-50"><?php echo date("d/m/y", strtotime($d3)) ?> <i class="bi-arrow-right-short "></i> <?php echo date("d/m/y", strtotime($f3)) ?></h6>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE En Attente -->
<div class="card border-warning mb-3">
<div class="card-header">
<h5><i class="fs-4 bi-hourglass-split text-warning"></i> En Attente</h5>
</div>
<a href="\tickets\list.php?state=4" class="text-decoration-none" target="_blank">
<div class="card-body">
<h1><span class="badge bg-warning"><?php echo $EnAttente; ?></span></h1>
<h6 class="text-decoration-none text-black-50"><?php echo date("d/m/y", strtotime($d4)) ?> <i class="bi-arrow-right-short "></i> <?php echo date("d/m/y", strtotime($f4)) ?></h6>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE Résolu -->
<div class="card border-success mb-3">
<div class="card-header">
<h5><i class="fs-4 bi-check-circle text-success"></i> Résolu</h5>
</div>
<a href="\tickets\list.php?state=5" class="text-decoration-none" target="_blank">
<div class="card-body">
<h1><span class="badge bg-success"><?php echo $Resolu; ?></span></h1>
<h6 class="text-decoration-none text-black-50"><?php echo date("d/m/y", strtotime($d5)) ?> <i class="bi-arrow-right-short "></i> <?php echo date("d/m/y", strtotime($f5)) ?></h6>
</div>
</a>
</div>
</div>
<div class="col"> <!-- CARTE Clos -->
<div class="card border-secondary mb-3">
<div class="card-header">
<h5><i class="fs-4 bi-check-all text-secondary"></i> Clos</h5>
</div>
<div class="card-body">
<h1><span class="badge bg-secondary"><?php echo $Clos; ?></span></h1>
<h6 class="text-decoration-none text-black-50"><?php echo date("d/m/y", strtotime($d6)) ?> <i class="bi-arrow-right-short "></i> <?php echo date("d/m/y", strtotime($f6)) ?></h6>
</div>
</div>
</div>
</div>
<div class="row flex-nowrap text-center">
<div class="col">
<div class="card border-success mb-3">
<div class="card-header"><h3>Age : 0-7 Jours</h3></div>
<div class="card-body" style="height: 300px">
<canvas id="C0" ></canvas>
</div>
</div>
</div>
<div class="col">
<div class="card border-warning mb-3">
<div class="card-header"><h3>Age 7-30 Jours</h3></div>
<div class="card-body" style="height: 300px">
<canvas id="C7"></canvas>
</div>
</div>
</div>
<div class="col">
<div class="card border-danger mb-3">
<div class="card-header"><h3>Age > 30 Jours</h3></div>
<div class="card-body" style="height: 300px">
<canvas id="C30"></canvas>
</div>
</div>
</div>
</div>
<br>
<h2><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Repartition acteurs <small><small> (en cours + planifié + en attente)</small></small></span></h2>
<div class="row flex-nowrap text-center">
<?php
$nb = explode(',',$repTot);$i=0;
foreach (explode(',',$repName) as $name) {
echo '<div class="col">';
echo '<div class="card mb-3">';
echo '<div class="card-header"><h6>'.(explode(' ',$name))[0].'</h6></div>';
echo '<div class="card-body">';
echo '<h3><span class="badge bg-primary">'.$nb[$i].'</span></h3>';
echo '</div>';
echo '</div>';
echo '</div>';
$ec -= $nb[$i];
$i++;
}
echo '<div class="col">';
echo '<div class="card mb-3">';
echo '<div class="card-header"><h6>Autre</h6></div>';
echo '<div class="card-body">';
echo '<h3><span class="badge bg-secondary">'.$ec.'</span></h3>';
echo '</div>';
echo '</div>';
echo '</div>';
?>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body>
<script>
Chart.defaults.global.legend.display = false;
var lab = ['Non Attribué','En Cours','Planifié','En Attente'];
var cols = ['rgba(220, 53, 69, 0.3)','rgba(13, 202, 240, 0.3)','rgba(13, 110, 253, 0.3)','rgba(255, 193, 7, 0.3)']
var bcols = ['rgba(220, 53, 69)','rgba(13, 202, 240)','rgba(13, 110, 253)','rgba(255, 193, 7)']
var dataC0 = document.getElementById("dataC0").innerHTML.split(",");
new Chart("C0", {
type: 'bar',
label: '',
data: {
labels: lab,
datasets: [{
backgroundColor: cols,
borderColor: bcols,
borderWidth: 1,
data: dataC0
}]
},
options: {
responsive: true,
maintainAspectRatio: false
}
});
var dataC7 = document.getElementById("dataC7").innerHTML.split(",");
new Chart("C7", {
type: 'bar',
label: '',
data: {
labels: lab,
datasets: [{
backgroundColor: cols,
borderColor: bcols,
borderWidth: 1,
data: dataC7
}]
},
options: {
responsive: true,
maintainAspectRatio: false
}
});
var dataC30 = document.getElementById("dataC30").innerHTML.split(",");
new Chart("C30", {
type: 'bar',
label: '',
data: {
labels: lab,
datasets: [{
backgroundColor: cols,
borderColor: bcols,
borderWidth: 1,
data: dataC30
}]
},
options: {
responsive: true,
maintainAspectRatio: false
}
});
</script>

View File

@@ -1,198 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<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>
<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>
<!-- Chart -->
<script src="/js/chart.min.js"></script>
</head>
<body>
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion -->
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
<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" style="zoom: 80%;">
<?php
$state = $_GET['state'];
switch ($state) {
case 1: $title = "Tickets non attribués"; break;
case 2: $title = "Tickets en cours"; break;
case 3: $title = "Tickets planifies"; break;
case 4: $title = "Tickets en attente"; break;
case 5: $title = "Tickets resolus"; break;
default:
}
?>
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo strtoupper($title); ?></span></h1>
<!-- Main content -->
<?php
DB_GLPI();
$conn->query("SET NAMES 'utf8'");
$sql = $conn->query("SELECT * FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state"); $r = mysqli_fetch_array($sql);
if($state > 1){
$n0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state and DATEDIFF(now(),date_creation) <= 7")))['total'];
$n7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$n30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state and DATEDIFF(now(),date_creation) > 30")))['total'];
}else{
$n0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) <= 7")))['total'];
$n7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$n30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) > 30")))['total'];
}
$sql = $conn->query(" SELECT count(*) as total, realname, firstname FROM glpi_tickets
left join glpi_tickets_users on glpi_tickets.id = glpi_tickets_users.tickets_id and glpi_tickets_users.type = 2
left join glpi_users on glpi_tickets_users.users_id = glpi_users.id
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and status = $state
and glpi_tickets_users.users_id in (SELECT glpi_users.id FROM glpi_groups_users left join glpi_users on users_id = glpi_users.id where glpi_groups_users.groups_id = 13)
group by glpi_tickets_users.users_id, realname
order by total desc");
$repName='';$repTot='';
while($row = mysqli_fetch_array($sql)){
$repName .= $row['firstname'].' '.$row['realname'].',';
$repTot .= $row['total'].',';
}
$repName = substr($repName, 0, -1);
$repTot = substr($repTot, 0, -1);
$sql = $conn->query(" SELECT count(*) as total FROM glpi_tickets
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and status = $state");
$r = mysqli_fetch_array($sql); $ec = $r['total'];
?>
<div class="row flex-nowrap text-center">
<div class="col">
<div class="card border-success mb-3">
<div class="card-header"><h3>Age : 0-7 Jours</h3></div>
<div class="card-body">
<h1><span class="badge bg-success"><?php echo $n0; ?></span></h1>
</div>
</div>
</div>
<div class="col">
<div class="card border-warning mb-3">
<div class="card-header"><h3>Age 7-30 Jours</h3></div>
<div class="card-body">
<h1><span class="badge bg-warning"><?php echo $n7; ?></span></h1>
</div>
</div>
</div>
<div class="col">
<div class="card border-danger mb-3">
<div class="card-header"><h3>Age > 30 Jours</h3></div>
<div class="card-body">
<h1><span class="badge bg-danger"><?php echo $n30; ?></span></h1>
</div>
</div>
</div>
</div>
<br>
<h2><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Répartition acteurs <small><small> (en cours + planifié + en attente)</small></small></span></h2>
<div class="row flex-nowrap text-center">
<?php
if($repName <> ''){
$nb = explode(',',$repTot);$i=0;
foreach (explode(',',$repName) as $name) {
echo '<div class="col">';
echo '<div class="card mb-3">';
echo '<div class="card-header"><h6>'.(explode(' ',$name))[0].'</h6></div>';
echo '<div class="card-body">';
echo '<h3><span class="badge bg-primary">'.$nb[$i].'</span></h3>';
echo '</div>';
echo '</div>';
echo '</div>';
$ec -= $nb[$i];
$i++;
}
echo '<div class="col">';
echo '<div class="card mb-3">';
echo '<div class="card-header"><h6>Autre</h6></div>';
echo '<div class="card-body">';
echo '<h3><span class="badge bg-secondary">'.$ec.'</span></h3>';
echo '</div>';
echo '</div>';
echo '</div>';
}
?>
</div>
<hr>
<!-- Liste des tickets -->
<?php
if($state > 1){
$sql = $conn->query(" SELECT glpi_tickets.date_creation, glpi_tickets.id, glpi_tickets.name, glpi_tickets.date_mod, users_id_lastupdater, realname, firstname FROM glpi_tickets
left join glpi_users on glpi_users.id = glpi_tickets.users_id_lastupdater
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and glpi_tickets.status = $state
order by date_creation desc");
}else{
$sql = $conn->query(" SELECT glpi_tickets.date_creation, glpi_tickets.id, glpi_tickets.name, glpi_tickets.date_mod, users_id_lastupdater, realname, firstname FROM glpi_tickets
left join glpi_users on glpi_users.id = glpi_tickets.users_id_lastupdater
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and glpi_tickets.id not in (select tickets_id from glpi_tickets_users where type = 2)
and glpi_tickets.status < 6
order by date_creation desc");
}
?>
<h2><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Liste des tickets</span></h2>
<table class='table table-bordered table-hover table-sm' id='t1'
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" data-loading-template="loadingTemplate"
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="620" data-show-export="true" data-sortable="true" style="width:99%;"
>
<thead>
<th data-field="Ticket" data-sortable="true">Ticket</th>
<th data-field="Date" data-sortable="true">Date Création</th>
<th data-field="Resume" data-sortable="true">Résumé</th>
<th data-field="Last" data-sortable="true">Dernière modification</th>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
echo "<tr>";
echo "<td><b><a href='https://web-glpi-aim.process.dkm/glpi/front/ticket.form.php?id=".$row['id']."' target='_blank'>".$row['id']."</a></b></td>";
echo "<td>".explode(" ",$row['date_creation'])[0]."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".explode(" ",$row['date_mod'])[0]." par ".$row['firstname']." ".$row['realname']."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body>

15
web.config Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
</files>
</defaultDocument>
<security>
<authorization>
<add accessType="Allow" roles="web-infra-reports" />
</authorization>
</security>
</system.webServer>
</configuration>

View File

@@ -28,199 +28,201 @@
</head> </head>
<body class="bg-light text-dark"> <body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader -->
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Database connexion --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Database connexion -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap"> <div class="row flex-nowrap">
<!-- Left NAVBAR --> <!-- 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;"> <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 --> <?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?> <!-- Left Navbar -->
</div> </div>
<!-- Display --> <!-- Display -->
<div class="col py-3"> <div class="col py-3">
<!-- Page Title --> <!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Workstations Crossover</span></h1> <h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Workstations Crossover</span></h1>
<!-- Main content --> <!-- Main content -->
<div class="row" style="zoom: 80%"> <div class="row" style="zoom: 80%">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php
$postes = Invoke_Infra("select * from cmdb_crossover_poste order by poste")
?>
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true"
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
data-height="620" data-show-export="true" data-sortable="true">
<thead>
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="OS" data-sortable="true">Operating System</th>
<th data-field="AD" data-sortable="true">AD</th>
<th data-field="ADlu" data-sortable="true" data-visible="false">AD Last Logon</th>
<th data-field="GLPI" data-sortable="true">GLPI</th>
<th data-field="GLPIlu" data-sortable="true" data-visible="false" data-footer-formatter="FI">Last FI
Inventory</th>
<th data-field="SCCM" data-sortable="true">SCCM<br></th>
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</th>
<th data-field="S1" data-sortable="true">SentinelOne<br></th>
<th data-field="S1lu" data-sortable="true" data-visible="false">SentinelOne Last Heartbeat</th>
</tr>
</thead>
<tbody>
<!-- Display DATAs -->
<?php <?php
$postes = Invoke_Infra("select * from cmdb_crossover_poste order by poste")
?>
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true" $ok = 0;
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" $total = 0;
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout" $nOS = 0;
data-height="620" data-show-export="true" data-sortable="true"> $nAD = 0;
<thead> $nSCCM = 0;
<th data-field="Name" data-sortable="true">Name</th> $nGLPI = 0;
<th data-field="OS" data-sortable="true">Operating System</th> $nFI = 0;
<th data-field="AD" data-sortable="true">AD</th> $nEPO = 0;
<th data-field="ADlu" data-sortable="true" data-visible="false">AD Last Logon</th> $nNBU = 0;
<th data-field="GLPI" data-sortable="true">GLPI</th> $nDPM = 0;
<th data-field="GLPIlu" data-sortable="true" data-visible="false" data-footer-formatter="FI">Last FI $nS1 = 0;
Inventory</th> foreach($postes as $row){
<th data-field="SCCM" data-sortable="true">SCCM<br></th> $total++;
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</th> echo "<tr>";
<th data-field="S1" data-sortable="true">SentinelOne<br></th> if (isset($row['ad']) && isset($row['glpi']) && isset($row['sccm']) && isset($row['s1'])) {
<th data-field="S1lu" data-sortable="true" data-visible="false">SentinelOne Last Heartbeat</th> echo "<td class='bg-success text-white'><b>" . $row['poste'] . "</b></td>";
</thead> $ok++;
} else {
<tbody> echo "<td><b>" . $row['poste'] . "</b></td>";
<!-- Display DATAs --> }
<?php if ($row['os']) {
if (preg_match('(7)', $row['os']) !== 1) {
$ok = 0; $nOS++;
$total = 0; echo "<td class='bg-success'>" . $row['os'] . "</td>";
$nOS = 0;
$nAD = 0;
$nSCCM = 0;
$nGLPI = 0;
$nFI = 0;
$nEPO = 0;
$nNBU = 0;
$nDPM = 0;
$nS1 = 0;
foreach($postes as $row){
$total++;
echo "<tr>";
if (isset($row['ad']) && isset($row['glpi']) && isset($row['sccm']) && isset($row['s1'])) {
echo "<td class='bg-success text-white'><b>" . $row['poste'] . "</b></td>";
$ok++;
} else { } else {
echo "<td><b>" . $row['poste'] . "</b></td>"; echo "<td class='bg-warning'>Windows 7</td>";
} }
if ($row['os']) { } else {
if (preg_match('(7)', $row['os']) !== 1) { echo "<td class='bg-warning'>&nbsp;</td>";
$nOS++; }
echo "<td class='bg-success'>" . $row['os'] . "</td>"; // AD
} else { if ($row['ad'] == 'Y') {
echo "<td class='bg-warning'>Windows 7</td>"; $date1 = date_create($row['adlu']);
} $diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 45) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['adlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else { } else {
echo "<td class='bg-warning'>&nbsp;</td>"; $nAD++;
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['adlu'] . "</td>";
} }
// AD } else {
if ($row['ad'] == 'Y') {
$date1 = date_create($row['adlu']); if (isset($row['ad'])) {
$diff = date_diff($date1, date_create(date("Y-m-d"))); $nAD++;
if ($diff->format("%R%a") > 45) { echo "<td class='bg-secondary'><small>" . $row['ad'] . "</small></td>";
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>"; echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
echo "<td class='bg-danger text-white'>" . $row['adlu'] . " (" . $diff->format("%R%a") . " days)</td>"; $nSCCM++;
} else { } else {
$nAD++; echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
}
}
// GLPI
if ($row['glpi'] == 'Y') {
$date1 = date_create($row['glpilu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['glpilu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
if ($row['glpilu'] <> "") {
echo "<td class='bg-success text-white'>OK</td>"; echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['adlu'] . "</td>"; $nFI++;
} echo "<td class='bg-success text-white'>" . $row['glpilu'] . "</td>";
} else {
if (isset($row['ad'])) {
$nAD++;
echo "<td class='bg-secondary'><small>" . $row['ad'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else { } else {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
echo "<td class='bg-warning text-white'>Missing</td>"; echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
} }
} }
$nGLPI++;
// GLPI } else {
if ($row['glpi'] == 'Y') { if (isset($row['glpi'])) {
$date1 = date_create($row['glpilu']); echo "<td class='bg-secondary'><small>" . $row['glpi'] . "</small></td>";
$diff = date_diff($date1, date_create(date("Y-m-d"))); echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['glpilu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
if ($row['glpilu'] <> "") {
echo "<td class='bg-success text-white'>OK</td>";
$nFI++;
echo "<td class='bg-success text-white'>" . $row['glpilu'] . "</td>";
} else {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
echo "<td class='bg-warning text-white'>Missing</td>";
}
}
$nGLPI++; $nGLPI++;
} else { } else {
if (isset($row['glpi'])) { echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-secondary'><small>" . $row['glpi'] . "</small></td>"; echo "<td class='bg-warning text-white'>&nbsp;</td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nGLPI++;
} else {
echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
}
} }
// SCCM
if ($row['sccm'] == 'Y') {
$date1 = date_create($row['sccmlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['sccmlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['sccmlu'] . "</td>";
$nSCCM++;
}
} else {
if (isset($row['sccm'])) {
echo "<td class='bg-secondary'><small>" . $row['sccm'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
}
}
// S1
if ($row['s1'] == 'Y') {
$date1 = date_create($row['s1lu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['s1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['s1lu'] . "</td>";
$nS1++;
}
} else {
if (isset($row['s1'])) {
echo "<td class='bg-secondary'><small>" . $row['s1'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
}
}
echo "</tr>";
} }
?>
</tbody>
</table> // SCCM
</div> if ($row['sccm'] == 'Y') {
<!-- End of main content --> $date1 = date_create($row['sccmlu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['sccmlu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['sccmlu'] . "</td>";
$nSCCM++;
}
} else {
if (isset($row['sccm'])) {
echo "<td class='bg-secondary'><small>" . $row['sccm'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
}
}
// S1
if ($row['s1'] == 'Y') {
$date1 = date_create($row['s1lu']);
$diff = date_diff($date1, date_create(date("Y-m-d")));
if ($diff->format("%R%a") > 7) {
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
echo "<td class='bg-danger text-white'>" . $row['s1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
} else {
echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['s1lu'] . "</td>";
$nS1++;
}
} else {
if (isset($row['s1'])) {
echo "<td class='bg-secondary'><small>" . $row['s1'] . "</small></td>";
echo "<td class='bg-secondary text-secondary'>&nbsp;</td>";
$nSCCM++;
} else {
echo "<td class='bg-warning text-white'>Missing</td>";
echo "<td class='bg-warning text-white'>&nbsp;</td>";
}
}
echo "</tr>";
}
?>
</tbody>
</table>
</div> </div>
<!-- End of main content -->
</div> </div>
</div> </div>
<script src="/js/switch.js"></script> </div>
<script src="/js/switch.js"></script>
</body> </body>
<script> <script>
var $table = $('#t1') let $table = $('#t1')
var $button = $('#button') let $button = $('#button')
$table.on('search.bs.table', function () { $table.on('search.bs.table', function () {
var $button = $('#button') let $button = $('#button')
$button.click(); $button.click();
}) })