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,8 +21,6 @@
<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">
@@ -45,15 +40,23 @@
<!-- 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']); $grouped_by_team[$team_name][] = $group;
}
foreach ($grouped_by_team as $team_name => $groups_in_team) {
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 "<br><br>";
} }
echo "<hr>"; echo "<hr>";

View File

@@ -95,7 +95,7 @@
}); });
$('#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();
} }

View File

@@ -51,13 +51,14 @@
<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 -->
@@ -135,15 +136,16 @@ $(function() {
}); });
function adjustTableHeight() { function adjustTableHeight() {
var windowHeight = $(window).height(); const table = $('#t1');
var tableTop = $('#t1').offset().top; const windowHeight = $(window).height();
var footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas const tableTop = table.offset().top;
var availableHeight = windowHeight - tableTop - footerHeight; const footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
let availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale // Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400); availableHeight = Math.max(availableHeight, 400);
$('#t1').bootstrapTable('refreshOptions', { table.bootstrapTable('refreshOptions', {
height: availableHeight height: availableHeight
}); });
} }

View File

@@ -50,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">
@@ -66,72 +66,150 @@
<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'>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 --> <tbody> <!-- Body -->
<?php <?php
$answers = Invoke_Infra("SELECT * FROM cmdb_vms where (owner like '%DUN%' or owner like '%mdk%') and owner not like '%VMH-WM%' and owner not like '%WKG%' and DecomTime is null order by name"); // --- STEP 1: DATA FETCHING ---
$clusters = Invoke_WebInfraTools("select distinct hostname from storage_lun where hostname like '%-c1%'"); // Fetch all necessary data with the minimum number of queries.
$lunsVNX = Invoke_WebInfraTools("select * from storage_lun where baie = 'VNX'");
$lunsSVC = Invoke_WebInfraTools("select * from storage_lun where baie = 'SVC'");
foreach ($answers as $row) {
echo "<tr>";
echo "<td>".$row['Name']."</td>";
if(strpos($row['Owner'],"SYN") !== false || strpos($row['Owner'],"MIG") !== false){
echo "<td></td><td>".$row['Owner']."</td>";
}else{
echo "<td>".$row['Owner']."</td><td></td>";
}
echo "<td>".str_replace(".vhdx,"," : ",str_replace("|","GB<br>",$row['VHDXs']))."GB</td>";
if($row['WWPNs'] != ""){
echo "<td>";
foreach($lunsVNX as $lun){
if($lun['hostname'] == $row['Name']){
echo explode("_",$lun['name'])[1]." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
echo "<td>";
foreach($lunsSVC as $lun){
if($lun['hostname'] == $row['Name']){
echo $lun['name']." : ".$lun['size']."GB<br>\n";
}
}
echo "</td>";
}else{echo "<td></td><td></td>";} // 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"); }
// Get the list of cluster hostnames from the LUNs we already fetched.
// This avoids an extra database query for clusters.
$cluster_hostnames = [];
foreach ($luns_by_hostname as $hostname => $luns) {
if (str_contains($hostname, '-c1')) {
$cluster_hostnames[] = $hostname;
}
}
sort($cluster_hostnames); // Sort them alphabetically
// --- STEP 3: RENDERING ---
// Now, loop through the prepared data and render the HTML.
// Use htmlspecialchars() on all output to prevent XSS attacks.
/**
* 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;
}
}
$html .= "</td>";
return $html;
}
// Render rows for VMs
foreach ($vms as $vm) {
echo "<tr>"; echo "<tr>";
echo "<td>".$row['hostname']." (Cluster)</td>"; echo "<td>" . htmlspecialchars($vm['Name']) . "</td>";
echo "<td></td><td></td><td></td>";
echo "<td>"; if (str_contains($vm['Owner'], "SYN") || str_contains($vm['Owner'], "MIG")) {
foreach($lunsVNX as $lun){ echo "<td></td><td>" . htmlspecialchars($vm['Owner']) . "</td>";
if($lun['hostname'] == $row['hostname']){ } else {
echo explode("_",$lun['name'])[1]." : ".$lun['size']."GB<br>\n"; 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;
} }
} }
echo "</td>"; // 3. Join all formatted parts with a comma and a space
echo "<td>"; echo "<td>" . implode('<br>', $vhdx_parts) . "</td>";
foreach($lunsSVC as $lun){
if($lun['hostname'] == $row['hostname']){ if ($vm['WWPNs'] != "") {
echo $lun['name']." : ".$lun['size']."GB<br>\n"; $hostname = $vm['Name'];
} $vnx_luns = $luns_by_hostname[$hostname]['VNX'] ?? [];
} $svc_luns = $luns_by_hostname[$hostname]['SVC'] ?? [];
echo "</td>"; echo renderLuns($vnx_luns, 'VNX');
echo renderLuns($svc_luns, 'SVC');
} else {
echo "<td></td><td></td>";
} }
echo "</tr>"; 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>
</tbody>
</table> </table>
<br> <br>
</div> </div>
@@ -145,8 +223,9 @@
</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

@@ -51,8 +51,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">
@@ -68,13 +68,14 @@
<div id="result" class="text-center"></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 -->
@@ -156,6 +157,7 @@
<SCRIPT> <SCRIPT>
$(function() { $(function() {
const table = $('#t1');
// Exécution initiale pour définir la hauteur // Exécution initiale pour définir la hauteur
adjustTableHeight(); adjustTableHeight();
@@ -165,15 +167,15 @@ $(function() {
}); });
function adjustTableHeight() { function adjustTableHeight() {
var windowHeight = $(window).height(); const windowHeight = $(window).height();
var tableTop = $('#t1').offset().top; const tableTop = table.offset().top;
var footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas const footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
var availableHeight = windowHeight - tableTop - footerHeight; let availableHeight = windowHeight - tableTop - footerHeight;
// Définir une hauteur minimale // Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400); availableHeight = Math.max(availableHeight, 400);
$('#t1').bootstrapTable('refreshOptions', { table.bootstrapTable('refreshOptions', {
height: availableHeight height: availableHeight
}); });
} }

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,27 +217,30 @@
</HTML> </HTML>
<SCRIPT> <SCRIPT>
$(document).ready(function() {
$('#t1').DataTable({
scrollY: '50vh',
scrollCollapse: true,
paging: false,
});
});
$(function() { $(function() {
var options = $('#t1').bootstrapTable('getOptions'); // Exécution initiale pour définir la hauteur
options.height= document.getElementById('content').clientHeight-170; adjustTableHeight();
$('#t1').bootstrapTable('refreshOptions',options);
// Événement de redimensionnement
$(window).on('resize', function() {
adjustTableHeight();
}); });
function tableresize() { function adjustTableHeight() {
var options = $('#t1').bootstrapTable('getOptions'); const table = $('#t1');
options.height= document.getElementById('content').clientHeight-170; const windowHeight = $(window).height();
$('#t1').bootstrapTable('refreshOptions',options); const tableTop = table.offset().top;
}; const footerHeight = 50; // Hauteur estimée pour d'éventuels éléments en bas
let availableHeight = windowHeight - tableTop - footerHeight;
window.addEventListener("resize", tableresize); // Définir une hauteur minimale
availableHeight = Math.max(availableHeight, 400);
table.bootstrapTable('refreshOptions', {
height: availableHeight
});
}
});
document.getElementById("ERR").innerHTML = "<?php echo $ERR ; ?>"; document.getElementById("ERR").innerHTML = "<?php echo $ERR ; ?>";

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,7 +24,7 @@
<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>
@@ -40,7 +40,8 @@
<!-- 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 <?php
@@ -48,22 +49,29 @@
$vmmem = (Invoke_Infra("select sum(cast(vm_memory as int)) as vmem from cmdb_HyperV_Hosts where cluster ='" . $_GET['cluster'] . "'"))[0]['vmem']; $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']; $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']; $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;} $clmem = $clumem - 32;
if ($nb == 4) {
$clmem = $clmem * 2;
}
?> ?>
<div class="container-fluid" style="zoom:100%"> <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> <h2><span class="badge text-bg-secondary font-weight-bold"
style="width:100%;"><?php echo $_GET['cluster']; ?></span></h2>
<?php <?php
echo "<b>Worst Failover scenario available memory : </b>" . ($clmem - $vmmem) . " / " . $clmem . " GB"; echo "<b>Worst Failover scenario available memory : </b>" . ($clmem - $vmmem) . " / " . $clmem . " GB";
$pcent = round(($clmem - $vmmem) / $clmem * 100); $pcent = round(($clmem - $vmmem) / $clmem * 100);
$pcent_restant = 100 - $pcent; $pcent_restant = 100 - $pcent;
if ($pcent <= 5) { if ($pcent <= 5) {
$color = "bg-danger"; $border = "red"; $color = "bg-danger";
$border = "red";
} else { } else {
if ($pcent <= 10) { if ($pcent <= 10) {
$color = "bg-warning"; $border = "yellow"; $color = "bg-warning";
$border = "yellow";
} else { } else {
$color = "bg-success"; $border = "green"; $color = "bg-success";
$border = "green";
} }
} }
echo " echo "
@@ -124,10 +132,12 @@
#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];
$used = explode(";", $csv)[2];
$free = $total - $used;
echo " Free : </b>" . $free . "/" . $total . " GB"; echo " Free : </b>" . $free . "/" . $total . " GB";
echo "</div>"; echo "</div>";
echo "<div class='col'>"; echo "<div class='col'>";
@@ -148,7 +158,9 @@
<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>"; echo "</div>";
}else{echo "<div class='col'></div><br>";} } else {
echo "<div class='col'></div><br>";
}
} }
echo "</div>"; echo "</div>";
echo "<hr>"; echo "<hr>";
@@ -159,10 +171,16 @@
echo "<div class='row'>"; echo "<div class='row'>";
echo "<div class='col'>"; echo "<div class='col'>";
$state = '<i class="bi bi-question-square-fill text-primary"></i> '; $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'] == "Running") {
if($vm['State'] == "Off" || $vm['State'] == "Stopping"){$state = '<i class="bi bi-stop-btn-fill text-danger"></i> ';} $state = '<i class="bi bi-play-btn-fill text-success"></i> ';
if($vm['State'] == "Paused"){$state = '<i class="bi bi-pause-btn-fill text-warning"></i> ';} }
if(strpos($vm['Name'],'WS') === 0){ 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>"; echo $state . " <b>" . substr($vm['Name'], 0, 10) . "</b>";
} else { } else {
echo $state . " <b>" . $vm['Name'] . "</b>"; echo $state . " <b>" . $vm['Name'] . "</b>";
@@ -174,9 +192,6 @@
if ($vm['WWPNs'] != "") { if ($vm['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> ';
} }
#echo "</div>";
#echo "<div class='col'>";
if ($vm['IsClustered'] != "True") { if ($vm['IsClustered'] != "True") {
echo '<span class="badge rounded-pill bg-danger text-dark"><small>Unclustered</small></span> '; echo '<span class="badge rounded-pill bg-danger text-dark"><small>Unclustered</small></span> ';
} else { } else {

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,7 +24,7 @@
<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>
@@ -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,17 +98,17 @@
?> ?>
<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 = "";
@@ -128,7 +129,7 @@
<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;
@@ -148,7 +149,7 @@
}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>";
} }
?> ?>
@@ -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";
@@ -216,10 +217,7 @@
<?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> </div>
<!-- End of main content --> <!-- End of main content -->
</div> </div>

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,10 +1,6 @@
<?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']);

View File

@@ -1,10 +1,6 @@
<?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']);

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);
} }
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);
}); });
} }
labels.sort(); return map;
const cpuDataMap = {}; };
const ramDataMap = {};
if (cpuKey && data[cpuKey]) { const cpuDataMap = createDataMap(cpuKey, data);
data[cpuKey].forEach(point => { const ramDataMap = createDataMap(ramKey, data);
cpuDataMap[point.datetime] = parseFloat(point.avg_value);
}); // Fonction pour générer les données du graphique
} const getChartData = (map, sortedLabels) => sortedLabels.map(label => map[label] ?? null);
if (ramKey && data[ramKey]) {
data[ramKey].forEach(point => { const cpuChartData = getChartData(cpuDataMap, labels);
ramDataMap[point.datetime] = parseFloat(point.avg_value); const ramChartData = getChartData(ramDataMap, labels);
});
} // Formatage des labels pour l'axe X
const cpuChartData = labels.map(label => cpuDataMap[label] || null);
const ramChartData = labels.map(label => ramDataMap[label] || null);
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
} }
if (ramKey && data[ramKey] && data[ramKey].length > 0) { // scaleLabel: { // Si vous vouliez un titre d'axe en v2 (ce que vous ne voulez pas)
const ctx2 = document.getElementById('ramChart').getContext('2d'); // display: false,
new Chart(ctx2, { // labelString: 'Utilisation (%)'
type: 'line', // }
data: { }],
labels: formattedLabels, xAxes: [{ // *** xAxes doit aussi être dans un tableau en v2.x ***
datasets: [{ // ... autres options pour l'axe X si nécessaire ...
label: 'Memory (%)',
data: ramChartData,
borderColor: 'rgb(54, 162, 235)',
backgroundColor: 'rgba(54, 162, 235, 0.1)',
fill: true,
tension: 0.3,
pointRadius: 0
}] }]
}, },
options: { tooltips: { // *** 'tooltips' au pluriel en v2.x ***
legend: {display: false}, callbacks: {
responsive: true, label: function(tooltipItem, data) { // Arguments différents en v2
maintainAspectRatio: false, let label = data.datasets[tooltipItem.datasetIndex].label || '';
scales: {y: {beginAtZero: true}} 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) { } 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

@@ -71,8 +71,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">
@@ -87,6 +87,7 @@
<div style="zoom:80%"> <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"> <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="Server" data-sortable="true">Server</th> <th data-field="Server" data-sortable="true">Server</th>
<th data-field="Type" data-sortable="true">Type</th> <th data-field="Type" data-sortable="true">Type</th>
<th data-field="January" data-sortable="true">January</th> <th data-field="January" data-sortable="true">January</th>
@@ -101,6 +102,7 @@
<th data-field="October" data-sortable="true">October</th> <th data-field="October" data-sortable="true">October</th>
<th data-field="November" data-sortable="true">November</th> <th data-field="November" data-sortable="true">November</th>
<th data-field="December" data-sortable="true">December</th> <th data-field="December" data-sortable="true">December</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
@@ -138,8 +140,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,
@@ -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

@@ -48,7 +48,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%;">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">
@@ -57,8 +57,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">
@@ -73,6 +73,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="Server" data-sortable="true">Server</th> <th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th> <th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="ACL" data-sortable="true">ACL</th> <th data-field="ACL" data-sortable="true">ACL</th>
@@ -82,7 +83,7 @@
<th data-field="Quota" data-sortable="true">Quota</th> <th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th> <th data-field="Size" data-sortable="true">Size</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 -->
@@ -118,9 +119,123 @@
<script src="/js/switch.js"></script> <script src="/js/switch.js"></script>
</HTML> </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>
<script src="/js/switch.js"></script>
</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

@@ -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%;">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">
@@ -53,8 +53,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">
@@ -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="Server" data-sortable="true">Server</th> <th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th> <th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th> <th data-field="Type" data-sortable="true">Type</th>
@@ -76,6 +77,7 @@
<th data-field="Quota" data-sortable="true">Quota</th> <th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th> <th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th> <th data-field="Users" data-sortable="true">Effective Users</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
@@ -110,8 +112,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,
@@ -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,10 +1,11 @@
<?php <?php
global $bdnuss;
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
$json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php", ''), true); $json = json_decode(PostJson("$bdnuss/Storage/SVC/SVC_INVENTORY.php", ''), true);
$poolsData = $json['Data']['Pools']; $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';
@@ -36,9 +37,9 @@ $seriesData = [
foreach ($poolsData as $poolName => $poolDetails) { foreach ($poolsData as $poolName => $poolDetails) {
$currentSeries = null; $currentSeries = null;
if (strpos($poolName, 'V5100') !== false) { if (str_contains($poolName, 'V5100')) {
$currentSeries = 'V5100'; $currentSeries = 'V5100';
} elseif (strpos($poolName, 'V5030') !== false) { } elseif (str_contains($poolName, 'V5030')) {
$currentSeries = 'V5030'; $currentSeries = 'V5030';
} }
if ($currentSeries) { if ($currentSeries) {
@@ -115,19 +116,6 @@ unset($data);
color: #555; 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 { .gain-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -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']);
@@ -259,11 +247,11 @@ unset($data);
<h5 class="card-title">Physical Capacity</h5> <h5 class="card-title">Physical 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['physical_used_percent'], 0) ?>%</span> <span class="percent"><?= number_format($data['physical_used_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div> <div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div> </div>
<div class="text-end"> <div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span> <span class="percent"><?= number_format($data['physical_free_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div> <div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
</div> </div>
</div> </div>
@@ -285,7 +273,7 @@ unset($data);
<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>
@@ -306,11 +294,11 @@ unset($data);
<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>
@@ -343,11 +331,11 @@ unset($data);
<h5 class="card-title">Physical Capacity</h5> <h5 class="card-title">Physical 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['physical_used_percent'], 0) ?>%</span> <span class="percent"><?= number_format($data['physical_used_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_used']) ?></div> <div class="value"><?= formatBytes($data['physical_used']) ?></div>
</div> </div>
<div class="text-end"> <div class="text-end">
<span class="percent"><?= number_format($data['physical_free_percent'], 0) ?>%</span> <span class="percent"><?= number_format($data['physical_free_percent']) ?>%</span>
<div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div> <div class="value"><?= formatBytes($data['physical_free'] / 2) ?></div>
</div> </div>
</div> </div>
@@ -369,7 +357,7 @@ unset($data);
<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>
@@ -390,11 +378,11 @@ unset($data);
<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>
@@ -475,7 +463,6 @@ unset($data);
<!-- 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>

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

@@ -51,7 +51,9 @@
<br> <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"> <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="luns" data-sortable="true">Luns</th> <th data-field="luns" data-sortable="true">Luns</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<?php echo $list; ?> <?php echo $list; ?>
@@ -62,6 +64,5 @@
<!-- 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>

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

@@ -53,8 +53,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">
@@ -69,9 +69,11 @@
<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='ts' data-sortable='true'>TimeStamp</th> <th data-field='ts' data-sortable='true'>TimeStamp</th>
<th data-field='host' data-sortable='true'>Host</th> <th data-field='host' data-sortable='true'>Host</th>
<th data-field='command' data-sortable='true'>Command</th> <th data-field='command' data-sortable='true'>Command</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
@@ -98,8 +100,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,
@@ -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

@@ -168,11 +168,14 @@
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 -->
<tr>
<th data-field='host' data-sortable='true'>Host</th> <th data-field='host' data-sortable='true'>Host</th>
<th data-field='OS' data-sortable='true'>OS</th> <th data-field='OS' data-sortable='true'>OS</th>
<th data-field='TimeStamp' data-sortable='true'>TimeStamp</th> <th data-field='TimeStamp' data-sortable='true'>TimeStamp</th>
<th data-field='RC' data-sortable='true'>RC</th> <th data-field='RC' data-sortable='true'>RC</th>
<th data-field='Result' data-sortable='true'>StdOut</th> <th data-field='Result' data-sortable='true'>StdOut</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->

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">
@@ -53,8 +53,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">
@@ -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

@@ -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 = "";
// Handle filters securely using prepared statements
if (isset($_GET['filter'])) {
$filter = $_GET['filter'];
$filterTitle = "Filter : " . htmlspecialchars($filter) . " non compliant";
switch ($filter) {
case "AD":
$whereClauses[] = "AD IS NULL OR (ADlu IS NOT NULL AND DATEDIFF(now(), ADlu) > 45)";
break;
case "OS":
$whereClauses[] = "OS LIKE '%2003%' OR OS LIKE '%2008%'";
break;
case "GLPI":
$whereClauses[] = "GLPI IS NULL OR GLPIlu IS NULL OR DATEDIFF(now(), GLPIlu) > 7";
break;
case "SCCM":
$whereClauses[] = "SCCM IS NULL OR (SCCMlu IS NOT NULL AND DATEDIFF(now(), SCCMlu) > 7)";
break;
case "NESSUS":
$whereClauses[] = "EPO IS NULL";
break;
case "NBU":
$whereClauses[] = "NBU IS NULL OR (NBUlu IS NOT NULL AND DATEDIFF(now(), NBUlu) > 30)";
break;
case "SCOM":
$whereClauses[] = "SCOM IS NULL";
break;
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;
}
if ($filterTitle) {
echo "<h2><div style=\"text-align: center;\"><span class='badge text-bg-danger font-weight-bold'>$filterTitle</span></div></h2>";
}
}
// Combine all WHERE clauses
if (!empty($whereClauses)) {
$sql .= " WHERE " . implode(' AND ', $whereClauses);
}
$sql .= " ORDER BY server";
// Prepare and execute the query
$stmt = $conn->prepare($sql);
// Note: If you had parameters, you would bind them here, e.g., $stmt->bind_param($types, ...$params);
$stmt->execute();
$result = $stmt->get_result();
// --- 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>";
}
try {
$diff = date_diff(date_create($lastUpdate), date_create());
$days = (int) $diff->format("%R%a");
if ($days > $daysThreshold) {
// Out of date
return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>$okText</td>"
. "<td class='bg-danger text-white'>$lastUpdate ($days days)</td>";
} else {
// Compliant
return "<td class='bg-success text-white'>$okText</td>"
. "<td class='bg-success text-white'>$lastUpdate</td>";
}
} catch (Exception) {
// 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>";
}
// --- PART 3: CLEAN DATA DISPLAY LOOP ---
// Initialize counters
$counters = [
'total' => 0, 'ok' => 0, 'nOS' => 0, 'nAD' => 0, 'nSCCM' => 0, 'nGLPI' => 0,
'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>";
}
}
$ok = 0;
$total = 0;
$nOS = 0;
$nAD = 0;
$nSCCM = 0;
$nGLPI = 0;
$nFI = 0;
$nNESSUS = 0;
$nNBU = 0;
$nDPM = 0;
$nS1 = 0;
while ($row = mysqli_fetch_array($result)) {
$total++;
echo "<tr>"; 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 $serverCell;
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 $osCell;
//echo "<td class='bg-success text-white'><b>".$row['Server']."</b></td>"; echo "<td>" . htmlspecialchars($row['crit'] ?? '') . "</td>";
$ok++; echo "<td>" . htmlspecialchars($row['dpt'] ?? '') . "</td>";
} 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 text-black'>" . $row['OS'] . "</td>";
}
} else {
echo "<td class='bg-warning'>&nbsp;</td>";
}
echo "<td>" . $row['crit'] . "</td>";
echo "<td>" . $row['dpt'] . "</td>";
// AD // Use helper function for status columns
if ($row['AD'] == 'Y') { echo renderStatusCellWithDate($row['AD'], $row['ADlu'], 45);
$date1 = date_create($row['ADlu']); echo renderStatusCellWithDate($row['GLPI'], $row['GLPIlu'], 7);
$diff = date_diff($date1, date_create(date("Y-m-d"))); echo renderStatusCellWithDate($row['SCCM'], $row['SCCMlu'], 7);
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>"; // NESSUS (EPO) Cell - Custom logic
echo "<td class='bg-danger text-white'>" . $row['ADlu'] . " (" . $diff->format("%R%a") . " days)</td>"; 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 { } else {
$nAD++; 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>"; echo "<td class='bg-success text-white'>OK</td>";
echo "<td class='bg-success text-white'>" . $row['ADlu'] . "</td>"; } elseif (isset($row['SCOM'])) {
} echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['SCOM']) . "</small></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='bg-warning text-black'>Missing</td>"; echo "<td class='bg-warning text-black'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
} }
// GLPI // Zabbix Cell - Simple logic
if ($row['GLPI'] == 'Y') { $zabbixStatus = $row['zabbix'] ?? '';
$date1 = date_create($row['GLPIlu']); if ($zabbixStatus === 'Y' || str_contains($zabbixStatus, '.')) {
$diff = date_diff($date1, date_create(date("Y-m-d"))); echo "<td class='bg-success text-white'>" . htmlspecialchars(str_replace('Y', 'OK', $zabbixStatus)) . "</td>";
if ($diff->format("%R%a") > 7) { } elseif (isset($row['zabbix'])) {
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'><small>" . htmlspecialchars($zabbixStatus) . "</small></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-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 { } else {
echo "<td class='bg-warning text-black'>Missing</td>"; echo "<td class='bg-warning text-black'>Missing</td>";
echo "<td class='bg-warning text-warning'>&nbsp;</td>";
}
} }
// SCCM // S1 Cell
if ($row['SCCM'] == 'Y') { $s1Status = $row['S1'] ?? '';
$date1 = date_create($row['SCCMlu']); $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%);'>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 (strpos($row['EPO'], '.') !== false ) {
echo "<td class='bg-success text-white'>".$row['EPO']."</td>";
} else {
if (isset($row['EPO']) && $row['EPO'] != 'Y' && $row['EPO'] != 'N') {
echo "<td class='bg-secondary'><small>" . $row['EPO'] . "</small></td>";
} else {
echo "<td class='bg-warning text-black'>Missing</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>";
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-black'>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-black'>Missing</td>";
}
}
// S1
if ($row['S1'] == 'Y' || strpos($row['S1'], '.') !== false) {
$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%);'>".str_replace('Y','OK',$row['S1'])."</td>";
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>"; 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,11 +408,11 @@
<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();
}) })
@@ -462,7 +420,36 @@
$('.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

@@ -25,8 +25,8 @@
</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">
@@ -43,20 +43,24 @@
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$rs = $conn->query('SELECT * FROM ADComputers order by name'); $rs = $conn->query('SELECT * FROM ADComputers order by 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-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="820" data-show-export="true" data-sortable="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> <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">OS</th> <th data-field="OS" data-sortable="true">OS</th>
<th data-field="Enabled" data-sortable="true">Enabled</th> <th data-field="Enabled" data-sortable="true">Enabled</th>
<th data-field="LasLogon" data-sortable="true">Last Logon</th> <th data-field="LasLogon" data-sortable="true">Last Logon</th>
<th data-field="OU" data-visible="false">OU</th> <th data-field="OU" data-visible="false">OU</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->

View File

@@ -25,9 +25,8 @@
</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 -->
@@ -43,7 +42,7 @@
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server"); $result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server");
?> ?>
@@ -52,8 +51,10 @@
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>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Version</th> <th data-field="LastUpdate" data-sortable="true">Version</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->

View File

@@ -25,9 +25,8 @@
</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 -->
@@ -43,7 +42,7 @@
<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
@@ -57,10 +56,12 @@
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>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="Type" data-sortable="true">Type</th> <th data-field="Type" data-sortable="true">Type</th>
<th data-field="Criticity" data-sortable="true">Criticity</th> <th data-field="Criticity" data-sortable="true">Criticity</th>
<th data-field="Inventory" data-sortable="true">Last F.I Inventory</th> <th data-field="Inventory" data-sortable="true">Last F.I Inventory</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->
@@ -68,35 +69,19 @@
while ($row = mysqli_fetch_array($result)) { while ($row = mysqli_fetch_array($result)) {
echo "<tr>"; echo "<tr>";
echo "<td>".$row['name']."</td>"; echo "<td>".$row['name']."</td>";
switch ($row['computertypes_id']) { echo match ($row['computertypes_id']) {
case 7: 7 => "<td>Serveur</td>",
echo "<td>Serveur</td>"; 19 => "<td>VM</td>",
break; 6 => "<td>Portable</td>",
case 19: 2 => "<td>PC</td>",
echo "<td>VM</td>"; default => "<td></td>",
break; };
case 6: echo match ($row['crit']) {
echo "<td>Portable</td>"; 1 => "<td>Silver</td>",
break; 2 => "<td>Gold</td>",
case 2: 3 => "<td>Bronze</td>",
echo "<td>PC</td>"; default => "<td></td>",
break; };
default:
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']){

View File

@@ -25,8 +25,8 @@
</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">
@@ -43,7 +43,7 @@
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where nbu = 'Y' order by server"); $result = $conn->query("SELECT * FROM GlobalCrossover where nbu = 'Y' order by server");
?> ?>
@@ -52,8 +52,10 @@
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>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="Last Backup" data-sortable="true">Last Backup</th> <th data-field="Last Backup" data-sortable="true">Last Backup</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->

View File

@@ -25,9 +25,8 @@
</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 -->
@@ -43,7 +42,7 @@
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server"); $result = $conn->query("SELECT * FROM GlobalCrossover where epo like '%.%' order by server");
?> ?>
@@ -52,8 +51,10 @@
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>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Version</th> <th data-field="LastUpdate" data-sortable="true">Version</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->

View File

@@ -25,9 +25,8 @@
</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 -->
@@ -43,7 +42,7 @@
<div class="row"> <div class="row">
<!-- Get DATAs --> <!-- Get DATAs -->
<?php <?php
DB_ENTRY02(); $conn = DB_ENTRY02();
$result = $conn->query("SELECT * FROM GlobalCrossover where S1 like '%.%' order by server"); $result = $conn->query("SELECT * FROM GlobalCrossover where S1 like '%.%' order by server");
?> ?>
@@ -52,8 +51,10 @@
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>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="LastUpdate" data-sortable="true">Last Seen</th> <th data-field="LastUpdate" data-sortable="true">Last Seen</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->

View File

@@ -25,8 +25,8 @@
</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">
@@ -43,7 +43,7 @@
<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
@@ -57,8 +57,10 @@
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>
<tr>
<th data-field="Name" data-sortable="true">Name</th> <th data-field="Name" data-sortable="true">Name</th>
<th data-field="last contact" data-sortable="true">Last Contact</th> <th data-field="last contact" data-sortable="true">Last Contact</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<!-- Display DATAs --> <!-- Display DATAs -->

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,13 +196,12 @@
<!-- 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: {
@@ -215,8 +213,8 @@ 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: {
@@ -228,8 +226,8 @@ 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: {
@@ -241,8 +239,8 @@ 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: {

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">
@@ -131,12 +128,12 @@
<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) {

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

@@ -44,7 +44,8 @@
<!-- 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">
@@ -53,8 +54,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">
@@ -69,6 +70,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="Server" data-sortable="true">Server</th> <th data-field="Server" data-sortable="true">Server</th>
<th data-field="Folder" data-sortable="true">Folder</th> <th data-field="Folder" data-sortable="true">Folder</th>
<th data-field="Type" data-sortable="true">Type</th> <th data-field="Type" data-sortable="true">Type</th>
@@ -76,6 +78,7 @@
<th data-field="Quota" data-sortable="true">Quota</th> <th data-field="Quota" data-sortable="true">Quota</th>
<th data-field="Size" data-sortable="true">Size</th> <th data-field="Size" data-sortable="true">Size</th>
<th data-field="Users" data-sortable="true">Effective Users</th> <th data-field="Users" data-sortable="true">Effective Users</th>
</tr>
</thead> </thead>
<tbody> <!-- Body --> <tbody> <!-- Body -->
@@ -110,6 +113,7 @@
</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

@@ -95,7 +95,7 @@
<?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,16 +158,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>

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

@@ -53,6 +53,7 @@
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-height="620" 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="AD" data-sortable="true">AD</th> <th data-field="AD" data-sortable="true">AD</th>
@@ -64,6 +65,7 @@
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</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="S1" data-sortable="true">SentinelOne<br></th>
<th data-field="S1lu" data-sortable="true" data-visible="false">SentinelOne Last Heartbeat</th> <th data-field="S1lu" data-sortable="true" data-visible="false">SentinelOne Last Heartbeat</th>
</tr>
</thead> </thead>
<tbody> <tbody>
@@ -216,11 +218,11 @@
</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();
}) })