Add backup and Fibre Channel switch management pages, update navbar.
- Introduce `/X/Backups.php` for Linux/AIX backup logs with dynamic filtering and export options. - Add `/Storage/SwitchsSAN.php` to display Fibre Channel switch status with detailed port stats and error handling. - Update `navbar.html` to include links to new pages and improve navigation consistency. - Enhance `Storage/Dashboard.php` with clickable link to orphan LUNs report.
This commit is contained in:
@@ -442,8 +442,10 @@
|
|||||||
<h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
|
<h5><i class="fs-4 bi-hdd text-black"></i> Unnasigned LUNs</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body bg-dark text-center fs-2">
|
<div class="card-body bg-dark text-center fs-2">
|
||||||
|
<a href="http://infra-tools.appliarmony.net/storage/svc-orphan-luns.php" target="_blank">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-html="true" data-toggle="tooltip"
|
<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>
|
data-placement="top" title="<?php echo $lLUN; ?>"><b><?php echo $unnasigned; ?></b></button>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
181
Storage/SwitchsSAN.php
Normal file
181
Storage/SwitchsSAN.php
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<!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">
|
||||||
|
|
||||||
|
<title>Infra Reports IT - SAN Status</title>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
|
||||||
|
|
||||||
|
<script src="/js/jquery-3.6.1.min.js"></script>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Custom styles to match the previous JS rendering */
|
||||||
|
.table-danger { background-color: #f8d7da !important; }
|
||||||
|
.table-success { background-color: #d1e7dd !important; }
|
||||||
|
/* Ensure text is readable on colored headers */
|
||||||
|
.card-header a { text-decoration: none; color: white; display: block; width: 100%; }
|
||||||
|
.card-header a:hover { color: #f0f0f0; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="bg-light text-dark">
|
||||||
|
<?php
|
||||||
|
// Include your existing libraries
|
||||||
|
include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php";
|
||||||
|
|
||||||
|
// --- PHP LOGIC START ---
|
||||||
|
|
||||||
|
// 1. Fetch JSON Data
|
||||||
|
// Ensure the PostJson function returns a valid JSON string
|
||||||
|
$jsonString = PostJson("$bdnuss/Storage/BROCADE/PORT/BROCADE_PORT_LIST.php", '');
|
||||||
|
|
||||||
|
// 2. Decode to PHP Array
|
||||||
|
$sanData = json_decode($jsonString, true);
|
||||||
|
|
||||||
|
// Check if decode was successful
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
$sanData = []; // Fallback to empty array to avoid errors
|
||||||
|
$errorMessage = "Error decoding JSON: " . json_last_error_msg();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container-fluid" id="content">
|
||||||
|
<div class="row flex-nowrap">
|
||||||
|
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark vh-100 position-sticky top-0" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
|
||||||
|
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col py-3">
|
||||||
|
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Fibre Channel Switch Status</span></h1>
|
||||||
|
|
||||||
|
<div class="container mt-4">
|
||||||
|
|
||||||
|
<?php if (isset($errorMessage)): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $errorMessage; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div id="accordion">
|
||||||
|
<?php
|
||||||
|
// 3. Loop through Switches
|
||||||
|
if (!empty($sanData)) {
|
||||||
|
$switchIndex = 0; // Iterator for unique IDs
|
||||||
|
|
||||||
|
foreach ($sanData as $switchName => $ports) {
|
||||||
|
$switchIndex++;
|
||||||
|
$collapseId = "collapse_" . $switchIndex; // Unique ID for Bootstrap
|
||||||
|
|
||||||
|
// Initialize counters
|
||||||
|
$upCount = 0;
|
||||||
|
$downCount = 0;
|
||||||
|
$errorCount = 0;
|
||||||
|
|
||||||
|
// Arrays to store HTML rows (for sorting logic)
|
||||||
|
$errorRows = [];
|
||||||
|
$normalRows = [];
|
||||||
|
|
||||||
|
// 4. Loop through Ports to calculate stats and build rows
|
||||||
|
foreach ($ports as $portId => $portData) {
|
||||||
|
$state = $portData['State'];
|
||||||
|
$errors = (int)$portData['Errors']; // Cast to int for safety
|
||||||
|
|
||||||
|
if ($state === 'UP') {
|
||||||
|
$upCount++;
|
||||||
|
|
||||||
|
// Determine row color
|
||||||
|
$rowClass = "table-success";
|
||||||
|
if ($errors > 0) {
|
||||||
|
$errorCount++;
|
||||||
|
$rowClass = "table-danger";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the HTML for this row
|
||||||
|
// Note: Using variables in double quotes for cleaner syntax
|
||||||
|
$rowHtml = "
|
||||||
|
<tr class='{$rowClass}'>
|
||||||
|
<td>{$portId}</td>
|
||||||
|
<td>{$portData['Status']}</td>
|
||||||
|
<td>{$portData['State']}</td>
|
||||||
|
<td>{$portData['Speed']}</td>
|
||||||
|
<td>{$portData['Nego']}</td>
|
||||||
|
<td>{$portData['FrameTX']}</td>
|
||||||
|
<td>{$portData['FrameRX']}</td>
|
||||||
|
<td><strong>{$portData['Errors']}</strong></td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
// Sort into appropriate array
|
||||||
|
if ($errors > 0) {
|
||||||
|
$errorRows[] = $rowHtml;
|
||||||
|
} else {
|
||||||
|
$normalRows[] = $rowHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif ($state === 'DN') {
|
||||||
|
$downCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Merge rows: Errors first
|
||||||
|
$finalRows = array_merge($errorRows, $normalRows);
|
||||||
|
$tableBody = implode("\n", $finalRows);
|
||||||
|
|
||||||
|
// 6. Determine Header Style
|
||||||
|
$headerColor = "green";
|
||||||
|
$msg = "OK";
|
||||||
|
if ($errorCount > 0) {
|
||||||
|
$headerColor = "DarkOrange";
|
||||||
|
$msg = "<b> --> {$errorCount} issue(s)</b>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7. Output the Accordion Item (Card)
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card" style="background-color:<?php echo $headerColor; ?>;">
|
||||||
|
<h4 class="card-header">
|
||||||
|
<a class="btn text-white fs-3 w-100 text-start" data-bs-toggle="collapse" href="#<?php echo $collapseId; ?>">
|
||||||
|
<b><?php echo strtoupper($switchName); ?> : <?php echo $upCount; ?> Ports UP / <?php echo ($upCount + $downCount); ?> : <?php echo $msg; ?></b>
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div id="<?php echo $collapseId; ?>" class="collapse" data-bs-parent="#accordion">
|
||||||
|
<div class="card-body bg-white border p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-hover mb-0 text-center">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th>Port</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>State</th>
|
||||||
|
<th>Speed</th>
|
||||||
|
<th>Nego</th>
|
||||||
|
<th>FrameTX</th>
|
||||||
|
<th>FrameRX</th>
|
||||||
|
<th>Errors</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php echo $tableBody; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} // End foreach Switch
|
||||||
|
} else {
|
||||||
|
echo "<div class='alert alert-warning'>No data available via API.</div>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div> </div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
157
X/Backups.php
Normal file
157
X/Backups.php
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-t">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<title>Web Infra Reports</title>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
|
||||||
|
|
||||||
|
<script src="/js/jquery-3.6.1.min.js"></script>
|
||||||
|
<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>
|
||||||
|
<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/global.php";
|
||||||
|
$list = Invoke_Infra("select * from X_cmdb_backupsys order by HOSTNAME");
|
||||||
|
$all = $_POST['show_all'] ?? 0;
|
||||||
|
|
||||||
|
// Si on affiche TOUT, alors on force l'affichage de la taille,
|
||||||
|
// ou on récupère la valeur normale si All n'est pas coché.
|
||||||
|
if ($all == 1) {
|
||||||
|
$showSize = 1;
|
||||||
|
} else {
|
||||||
|
$showSize = $_POST['show_size'] ?? 0;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container-fluid" id="content">
|
||||||
|
<div class="row flex-nowrap">
|
||||||
|
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark vh-100 position-sticky top-0" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
|
||||||
|
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col py-3">
|
||||||
|
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Backups Linux/AIX</span></h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-start align-items-center mb-2 p-2 rounded bg-secondary-subtle">
|
||||||
|
<form class="form-inline d-flex gap-4" action="Backups.php" method="post" >
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch"
|
||||||
|
id="showAll" name="show_all" value="1"
|
||||||
|
<?php echo ($all == 1) ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="showAll"><strong>All</strong></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check form-switch" <?php echo ($all == 1) ? 'style="display:none;"' : ''; ?>>
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch"
|
||||||
|
id="showSize" name="show_size" value="1"
|
||||||
|
<?php echo ($showSize == 1) ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="showSize"><strong>Size >= 15GB</strong></label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</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">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-field="Name" data-sortable="true">Name</th>
|
||||||
|
<th data-field="ts" data-sortable="true">TS</th>
|
||||||
|
<th data-field="Log" data-sortable="true">Log</th>
|
||||||
|
<th data-field="Type" data-sortable="true">Type</th>
|
||||||
|
<th data-field="Location" data-sortable="true">Location</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$now = new DateTime();
|
||||||
|
foreach ($list as $s) {
|
||||||
|
$name = $s['HOSTNAME'];
|
||||||
|
$ts = $s['ts'];
|
||||||
|
$lastBackup = (explode(".",$s['LastBackup']))[0];
|
||||||
|
$location = $s['Location'];
|
||||||
|
$log = $s['Log'];
|
||||||
|
$backuptype = $s['BackupType'];
|
||||||
|
|
||||||
|
if(str_contains($log, "Length")) {
|
||||||
|
$size = floor(explode(" ",$log)[1] / 1024 / 1024 / 1024);
|
||||||
|
if(explode(" ",$log)[1] > 16106127360) {
|
||||||
|
$log = "Size : $size GB";
|
||||||
|
if($showSize == 0){ continue; }
|
||||||
|
}else{
|
||||||
|
$log = "OK - $size GB";
|
||||||
|
if($all == 0){ continue; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(str_contains($log, "Total bytes written:")) {
|
||||||
|
$size = floor(explode(" ",$log)[3] / 1024 / 1024 / 1024);
|
||||||
|
if(explode(" ",$log)[3] > 16106127360) {
|
||||||
|
$log = "Size : $size GB";
|
||||||
|
if($showSize == 0){ continue; }
|
||||||
|
}else{
|
||||||
|
$log = "OK - $size GB";
|
||||||
|
if($all == 0){ continue; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "</tr>";
|
||||||
|
|
||||||
|
echo "<td>$name</td>";
|
||||||
|
echo "<td>$ts</td>";
|
||||||
|
if(str_contains($log, "waiting")) {
|
||||||
|
echo "<td class='table-primary'><b>$log</b></td>";
|
||||||
|
}elseif(str_contains($log, "error")){
|
||||||
|
echo "<td class='table-danger'><b>$log</b></td>";
|
||||||
|
}elseif(str_contains($log, "progress")){
|
||||||
|
echo "<td class='table-success'><b>$log</b></td>";
|
||||||
|
}elseif(str_contains($log, "OK -")){
|
||||||
|
echo "<td class='table-success'>$log</td>";
|
||||||
|
}elseif(str_contains($log, "Size : ")){
|
||||||
|
echo "<td class='table-warning'>$log</td>";
|
||||||
|
}else{echo "<td>$log</td>"; }
|
||||||
|
echo "<td>$backuptype</td>";
|
||||||
|
echo "<td>$location</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table><br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script src="/js/switch.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
// Dès que le switch #showAll change d'état
|
||||||
|
$('#showAll').on('change', function() {
|
||||||
|
// On soumet le formulaire le plus proche (le parent)
|
||||||
|
$(this).closest('form').submit();
|
||||||
|
});
|
||||||
|
$('#showSize').on('change', function() {
|
||||||
|
// On soumet le formulaire le plus proche (le parent)
|
||||||
|
$(this).closest('form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</HTML>
|
||||||
|
<script src="/js/tableResize.js"></script>
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
<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/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/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>
|
<a href="/X/stdout.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Scripts Result</span></a>
|
||||||
|
<a href="/X/backups.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Backups</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -78,6 +79,8 @@
|
|||||||
<ul class="collapse nav flex-column ms-1" id="Storage" data-bs-parent="#menu">
|
<ul class="collapse nav flex-column ms-1" id="Storage" data-bs-parent="#menu">
|
||||||
<li class="w-100">
|
<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/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/switchssan.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Switchs FC</span></a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user