- Add detailed HTTP error handling in web.config
- Update comments in `Server-Detail.php` to reflect current tools - Introduce AIX/Linux backup details in `Server-Detail.php` - Add `/X/inventory.php` for AIX/Linux server inventory display functionality - Update `navbar.html` to include link to the new server inventory page
This commit is contained in:
@@ -252,7 +252,7 @@
|
|||||||
?>
|
?>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<!-- Last boot, last rollup, next rollup -->
|
<!-- Zabbix, Sentinel1, Nessus -->
|
||||||
<?php
|
<?php
|
||||||
if(is_array($Qw)){
|
if(is_array($Qw)){
|
||||||
if(strpos($Qw[0]['zabbix'], '.')){
|
if(strpos($Qw[0]['zabbix'], '.')){
|
||||||
@@ -291,6 +291,18 @@
|
|||||||
echo " <span class='badge rounded-pill bg-warning text-dark fs-5'>Nessus : Not Installed</span>";
|
echo " <span class='badge rounded-pill bg-warning text-dark fs-5'>Nessus : Not Installed</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- Backup for AIX, Linux -->
|
||||||
|
<?php
|
||||||
|
if(is_array($Qx)){
|
||||||
|
$backup = Invoke_Infra("select * from X_cmdb_Backupsys where HOSTNAME='$server'");
|
||||||
|
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>LastBackup : ".explode(".",$backup[0]['LastBackup'])[0]."</span> ";
|
||||||
|
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>BackupType : ".$backup[0]['BackupType']."</span> ";
|
||||||
|
echo "<span class='badge rounded-pill bg-secondary text-light fs-5'>Media : ".$backup[0]['Location']."</span>";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- End of main content -->
|
<!-- End of main content -->
|
||||||
|
|||||||
243
X/Inventory.php
Normal file
243
X/Inventory.php
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
<!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>Infra Tools 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"; ?> <!-- Constants -->
|
||||||
|
<?php // DATA
|
||||||
|
$servers = Invoke_Infra("select * from x_inventory where type is not null");
|
||||||
|
$UTDS1 = (Invoke_Infra("select max(Ver) as utd from X_cmdb_Product where Name = 's1'"))[0]['utd'];
|
||||||
|
$UTDNessus = (Invoke_Infra("select max(Ver) as utd from X_cmdb_Product where Name = 'nessus'"))[0]['utd'];
|
||||||
|
$UTDZabbix = (Invoke_Infra("select max(Ver) as utd from X_cmdb_Product where Name = 'zabbix'"))[0]['utd'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- 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%;">AIX / Linux inventory</span></h1>
|
||||||
|
|
||||||
|
<!-- Main content -->
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- 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="Name" data-sortable="true">Name</th>
|
||||||
|
<th data-field="OS" data-sortable="true">OS Type</th>
|
||||||
|
<th data-field="distrib" data-sortable="true">Distrib</th>
|
||||||
|
<th data-field="Last Boot" data-sortable="true">Last reboot</th>
|
||||||
|
<th data-field="Last Backup" data-sortable="true">Last backup</th>
|
||||||
|
<th data-field="Auth" data-sortable="true">Auth</th>
|
||||||
|
<th data-field="SentinelOne" data-sortable="true">SentinelOne</th>
|
||||||
|
<th data-field="Nessus" data-sortable="true">Nessus</th>
|
||||||
|
<th data-field="Zabbix" data-sortable="true">Zabbix</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody> <!-- Body -->
|
||||||
|
<?php
|
||||||
|
$total = 0;
|
||||||
|
foreach ($servers as $s) {
|
||||||
|
$total++;
|
||||||
|
echo "<tr>";
|
||||||
|
//name
|
||||||
|
$name = $s['hostname'];
|
||||||
|
echo "<td><a href='/inventory/server-detail.php?s=".$name."' target='_blank'>$name</a></td>";
|
||||||
|
|
||||||
|
//OS Type
|
||||||
|
$typ = match ($s['type'] ?? null) {
|
||||||
|
'AIX' => 'AIX',
|
||||||
|
null, '' => '',
|
||||||
|
default => 'LINUX',
|
||||||
|
};
|
||||||
|
echo "<td>".$s['type']."</td>";
|
||||||
|
|
||||||
|
//Distrib
|
||||||
|
$Distrib = "";
|
||||||
|
if($typ == "AIX"){
|
||||||
|
$Distrib = $s['osversion'];
|
||||||
|
}
|
||||||
|
if($typ == "LINUX"){
|
||||||
|
$Distrib = $s['osversion']." <small>(".str_replace(".x86_64","",$s['kernel']).")</small>";
|
||||||
|
}
|
||||||
|
echo "<td>$Distrib</td>";
|
||||||
|
|
||||||
|
//LastReboot
|
||||||
|
$lr = $s['lastboot'] ?? ""; $lrDate="";
|
||||||
|
try {
|
||||||
|
$lrDate = new DateTime($lr);
|
||||||
|
} catch (DateMalformedStringException $e) {}
|
||||||
|
$interval = (new DateTime())->diff($lrDate);
|
||||||
|
if($interval->days > 60){
|
||||||
|
echo "<td class='table-danger'>$lr</td>";
|
||||||
|
}else{
|
||||||
|
if($interval->days > 1){
|
||||||
|
echo "<td>$lr</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-success'>$lr</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//LastBackup
|
||||||
|
$lr = explode(".",$s['backuplast'] ?? "")[0];
|
||||||
|
$size = 0;
|
||||||
|
if($s['backuplog'] != "") {
|
||||||
|
if (str_contains($s['backuplog'],"Length")) {
|
||||||
|
$size = explode(" ", $s['backuplog'])[1];
|
||||||
|
} else {
|
||||||
|
$size = explode(" ", $s['backuplog'])[3];
|
||||||
|
}
|
||||||
|
$size = floor($size / 1024 / 1024 / 1024);
|
||||||
|
}
|
||||||
|
if($size >= 20){
|
||||||
|
$size = "<span class='text-danger'><b>$size GB</b></span>";
|
||||||
|
}else{
|
||||||
|
$size = "$size GB";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$lrDate = new DateTime($lr);
|
||||||
|
} catch (DateMalformedStringException $e) {}
|
||||||
|
$interval = (new DateTime())->diff($lrDate);
|
||||||
|
if($interval->days > 7 || $s['backuplast'] == ""){
|
||||||
|
echo "<td class='table-danger'>$lr"." ".$size."</td>";
|
||||||
|
}else{
|
||||||
|
if($interval->days > 1){
|
||||||
|
echo "<td>".date_format($lrDate,"Y-m-d H:i:s")." - ".$size."</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-success'>$lr"." - ".$size."</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Auth
|
||||||
|
echo "<td>".$s['auth']."</td>";
|
||||||
|
|
||||||
|
//SentinelOne
|
||||||
|
$s1s = $s['S1State']; $s1v = $s['S1Version'];
|
||||||
|
if($typ == "LINUX"){
|
||||||
|
if($s1s == "YY"){
|
||||||
|
if($s1v == $UTDS1) {
|
||||||
|
echo "<td class='table-success'>$s1v $s1s</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-warning'><b>$s1v</b> $s1s</td>";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($s1v == "") {
|
||||||
|
echo "<td class='table-danger text-center'>MISSING</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-danger'>$s1v <b>$s1s</b></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
echo "<td></td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Nessus
|
||||||
|
$s1s = $s['NessusState']; $s1v = $s['NessusVersion'];
|
||||||
|
if($typ == "LINUX"){
|
||||||
|
if($s1s == "YYY_YYY"){
|
||||||
|
if($s1v == $UTDNessus) {
|
||||||
|
echo "<td class='table-success'>$s1v $s1s</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-warning'><b>$s1v</b> $s1s</td>";
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if ($s1v == "") {
|
||||||
|
echo "<td class='table-danger text-center'>MISSING</td>";
|
||||||
|
} else {
|
||||||
|
echo "<td class='table-danger'>$s1v <b>$s1s</b></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
echo "<td></td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Zabbix
|
||||||
|
$s1s = $s['ZabbixState']; $s1v = $s['ZabbixVersion'];
|
||||||
|
if($s1s == "Y"){
|
||||||
|
if($s1v == $UTDZabbix) {
|
||||||
|
echo "<td class='table-success'>$s1v $s1s</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-warning'><b>$s1v</b> $s1s</td>";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($s1v == "") {
|
||||||
|
echo "<td class='table-danger text-center'>MISSING</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class='table-danger'>$s1v <b>$s1s</b></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table><br>
|
||||||
|
<h5 class="text-center"><?php echo $total; ?> servers</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End of main content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script src="/js/switch.js"></script>
|
||||||
|
</HTML>
|
||||||
|
|
||||||
|
<SCRIPT>
|
||||||
|
let table = $('#t1');
|
||||||
|
$(document).ready(function() {
|
||||||
|
table.DataTable({
|
||||||
|
scrollY: '50vh',
|
||||||
|
scrollCollapse: true,
|
||||||
|
paging: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
let options = table.bootstrapTable('getOptions');
|
||||||
|
options.height= document.getElementById('content').clientHeight-170;
|
||||||
|
table.bootstrapTable('refreshOptions',options);
|
||||||
|
});
|
||||||
|
|
||||||
|
function tableresize() {
|
||||||
|
let options = table.bootstrapTable('getOptions');
|
||||||
|
options.height= document.getElementById('content').clientHeight-170;
|
||||||
|
table.bootstrapTable('refreshOptions',options);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("resize", tableresize);
|
||||||
|
</SCRIPT>
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
<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>
|
<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">
|
<ul class="collapse nav flex-column ms-1" id="Unix" data-bs-parent="#menu">
|
||||||
<li class="w-100">
|
<li class="w-100">
|
||||||
|
<a href="/X/inventory.php" class="nav-link px-0"> <span class="d-none d-sm-inline text-white h7">- Server Inventory</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/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>
|
||||||
|
|||||||
@@ -11,5 +11,6 @@
|
|||||||
<add accessType="Allow" roles="web-infra-reports" />
|
<add accessType="Allow" roles="web-infra-reports" />
|
||||||
</authorization>
|
</authorization>
|
||||||
</security>
|
</security>
|
||||||
|
<httpErrors errorMode="Detailed" existingResponse="PassThrough" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
Reference in New Issue
Block a user