Refactor and enhance code readability across multiple components
- Updated SQL query in `VMs-Backups.php` to include `policy` condition. - Improved formatting and indentation in `StdOut-detail.php`, `StdOut.php`, and `Server-Detail.php`. - Simplified conditional checks and removed redundant spaces for better clarity. - Modified `.idea/sqldialects.xml` file to add new SQL dialect mappings.
This commit is contained in:
@@ -173,8 +173,8 @@
|
|||||||
$wwpns = "";
|
$wwpns = "";
|
||||||
if($luns[0]['lun'] == 0){$luns = "Some LUNs are owned by cluster";}else{$luns = $luns[0]['lun']." LUNs";}
|
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(is_array($Qvm)){$wwpns = str_replace("|",", ",$Qvm[0]['WWPNs']);}
|
||||||
echo "<center><span class='badge rounded-pill bg-primary text-light fs-5'>".$luns."</span>";
|
echo "<div style=\"text-align: center;\"><span class='badge rounded-pill bg-primary text-light fs-5'>" .$luns."</span>";
|
||||||
if($wwpns != ""){echo " <span class='badge rounded-pill bg-secondary text-light fs-5'>WWPNs :".$wwpns."</span></center><br>";}else{echo "</center><br>";}
|
if($wwpns != ""){echo " <span class='badge rounded-pill bg-secondary text-light fs-5'>WWPNs :".$wwpns."</span></div><br>";}else{echo "</div><br>";}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="row" id="drives">
|
<div class="row" id="drives">
|
||||||
@@ -287,8 +287,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<script src="/js/switch.js"></script>
|
<script src="/js/switch.js"></script>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
|
||||||
$(function () {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ $data = [];
|
|||||||
// Get CPU & Memory Items
|
// Get CPU & Memory Items
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
||||||
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
|
$valueType = $item['value_type'] ?? ($isMemory ? 3 : 0);
|
||||||
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
||||||
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
|
$table = $tableMap[$valueType] ?? ($isMemory ? 'history_uint' : 'history');
|
||||||
// Get History Data
|
// Get History Data
|
||||||
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
||||||
AVG(value) AS avg_value
|
AVG(value) AS avg_value
|
||||||
@@ -51,7 +51,6 @@ foreach ($items as $item) {
|
|||||||
}
|
}
|
||||||
$data[$item['name']] = $results;
|
$data[$item['name']] = $results;
|
||||||
}
|
}
|
||||||
// Send Json back
|
// Send JSON back
|
||||||
echo json_encode($data, JSON_NUMERIC_CHECK);
|
echo json_encode($data, JSON_NUMERIC_CHECK);
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -30,9 +30,9 @@ $data = [];
|
|||||||
// Get CPU & Memory Items
|
// Get CPU & Memory Items
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
||||||
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
|
$valueType = $item['value_type'] ?? ($isMemory ? 3 : 0);
|
||||||
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
||||||
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
|
$table = $tableMap[$valueType] ?? ($isMemory ? 'history_uint' : 'history');
|
||||||
// Get History Data
|
// Get History Data
|
||||||
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
||||||
AVG(value) AS avg_value
|
AVG(value) AS avg_value
|
||||||
@@ -51,7 +51,6 @@ foreach ($items as $item) {
|
|||||||
}
|
}
|
||||||
$data[$item['name']] = $results;
|
$data[$item['name']] = $results;
|
||||||
}
|
}
|
||||||
// Send Json back
|
// Send JSON back
|
||||||
echo json_encode($data, JSON_NUMERIC_CHECK);
|
echo json_encode($data, JSON_NUMERIC_CHECK);
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php /** @noinspection PhpIllegalStringOffsetInspection */
|
||||||
// Zabbix DB
|
// Zabbix DB
|
||||||
$host = 'aztprdzabbix52.armony.net';
|
$host = 'aztprdzabbix52.armony.net';
|
||||||
$dbname = 'zabbix';
|
$dbname = 'zabbix';
|
||||||
@@ -30,9 +30,9 @@ $data = [];
|
|||||||
// Get CPU & Memory Items
|
// Get CPU & Memory Items
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
$isMemory = strpos(strtolower($item['name']), 'memory') !== false;
|
||||||
$valueType = isset($item['value_type']) ? $item['value_type'] : ($isMemory ? 3 : 0);
|
$valueType = $item['value_type'] ?? ($isMemory ? 3 : 0);
|
||||||
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
$tableMap = [0 => 'history', 1 => 'history_str', 2 => 'history_log', 3 => 'history_uint', 4 => 'history_text'];
|
||||||
$table = isset($tableMap[$valueType]) ? $tableMap[$valueType] : ($isMemory ? 'history_uint' : 'history');
|
$table = $tableMap[$valueType] ?? ($isMemory ? 'history_uint' : 'history');
|
||||||
// Get History Data
|
// Get History Data
|
||||||
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
$sql = "SELECT FROM_UNIXTIME(FLOOR(clock / 600) * 600) AS datetime,
|
||||||
AVG(value) AS avg_value
|
AVG(value) AS avg_value
|
||||||
@@ -51,7 +51,6 @@ foreach ($items as $item) {
|
|||||||
}
|
}
|
||||||
$data[$item['name']] = $results;
|
$data[$item['name']] = $results;
|
||||||
}
|
}
|
||||||
// Send Json back
|
// Send JSON back
|
||||||
echo json_encode($data, JSON_NUMERIC_CHECK);
|
echo json_encode($data, JSON_NUMERIC_CHECK);
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -21,4 +21,3 @@
|
|||||||
}
|
}
|
||||||
echo json_encode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user