Remove test.php and enhance null safety and sorting across components
- Deleted `test.php` as it was no longer in use. - Enhanced null safety checks in `Inventory.php`, `StdOut-detail.php`, `Backups.php`, and `SwitchsSAN.php` to prevent potential warnings. - Refactored `SwitchsSAN.php` to improve sorting logic for ports based on errors, vFabric, and Port ID. - Added seasonal snow effect script in `all.php` with toggle functionality for user engagement. - Updated navigation bar (`navbar.html`) to include a new VIO page link. - Introduced a new `VIO.php` page to display VIO monitoring details with table export and sorting features.
This commit is contained in:
@@ -79,69 +79,87 @@
|
||||
|
||||
<tbody> <!-- Body -->
|
||||
<?php
|
||||
// get all active servers
|
||||
$today = date("Y-m-d");
|
||||
$active = Invoke_Infra("SELECT name from cmdb_vms where LastInventory like'$today%'");
|
||||
$active = array_column($active, 'name');
|
||||
|
||||
// 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) and policy is not null order by lastresult,name");
|
||||
foreach ($answers as $row) {
|
||||
$er++;
|
||||
$date1 = date_create($row['LastKnownGood']??'01/01/1970'); $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>";
|
||||
if(in_array($row['Name'], $active)){
|
||||
$er++;
|
||||
$date1 = date_create($row['LastKnownGood'] ?? '01/01/1970');
|
||||
$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>";
|
||||
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{
|
||||
if (in_array($row['Name'], $active)) {
|
||||
$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++;
|
||||
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>";
|
||||
}
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user