Edit code and Dockerfile

هذا الالتزام موجود في:
root
2026-07-27 03:33:09 +00:00
الأصل 05edcc3fce
التزام 8fa1893c85
6 ملفات معدلة مع 187 إضافات و371 حذوفات

عرض الملف

@@ -8,255 +8,195 @@
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
*{
margin:0;
padding:0;
box-sizing:border-box;
font-family:Arial,Helvetica,sans-serif;
}
body{
background:#f4f6f9;
padding:30px;
font-family:Arial,sans-serif;
background:#f4f4f4;
margin:20px;
}
h1{
text-align:center;
margin-bottom:30px;
color:#2c3e50;
}
.cards{
display:grid;
grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
gap:20px;
margin-bottom:30px;
margin:20px 0;
}
.card{
background:white;
border-radius:10px;
padding:20px;
box-shadow:0 3px 8px rgba(0,0,0,.15);
border-radius:10px;
box-shadow:0 2px 6px rgba(0,0,0,.2);
}
.card h3{
color:#555;
margin-bottom:10px;
}
.value{
font-size:30px;
font-size:28px;
color:#007bff;
font-weight:bold;
color:#007BFF;
}
table{
width:100%;
border-collapse:collapse;
background:white;
margin-top:30px;
box-shadow:0 3px 8px rgba(0,0,0,.15);
background:white;
}
table th{
background:#007BFF;
color:white;
padding:12px;
}
table td{
th,td{
border:1px solid #ddd;
padding:10px;
text-align:center;
border-bottom:1px solid #ddd;
}
th{
background:#007bff;
color:white;
}
canvas{
background:white;
margin-top:30px;
padding:20px;
background:white;
padding:15px;
border-radius:10px;
box-shadow:0 3px 8px rgba(0,0,0,.15);
}
.good{
color:green;
font-weight:bold;
}
.bad{
color:red;
font-weight:bold;
}
</style>
</head>
</head>
<body>
<h1>🚀 Mithal Monitoring Dashboard</h1>
<h1>Mithal Monitoring Dashboard</h1>
<div class="cards">
<div class="card">
<h3>Uptime (24h)</h3>
<div id="uptime" class="value">-- %</div>
<h3>Uptime</h3>
<div id="uptime" class="value">--</div>
</div>
<div class="card">
<h3>Latency</h3>
<div id="latency" class="value">-- ms</div>
<div id="latency" class="value">--</div>
</div>
<div class="card">
<h3>DNS Lookup</h3>
<div id="dns" class="value">-- ms</div>
<h3>DNS</h3>
<div id="dns" class="value">--</div>
</div>
<div class="card">
<h3>Search Response</h3>
<div id="search" class="value">-- ms</div>
<h3>Search</h3>
<div id="search" class="value">--</div>
</div>
<div class="card">
<h3>SSL Expiry</h3>
<div id="ssl" class="value" style="font-size:22px;">--</div>
<div id="ssl" class="value" style="font-size:18px">--</div>
</div>
<div class="card">
<h3>Days Remaining</h3>
<h3>Days Left</h3>
<div id="days" class="value">--</div>
</div>
</div>
<canvas id="latencyChart" height="100"></canvas>
<canvas id="chart"></canvas>
<table>
<thead>
<tr>
<th>Time</th>
<th>Status</th>
<th>Latency</th>
<th>DNS</th>
<th>Search</th>
<th>SSL Days</th>
</tr>
</thead>
<tbody id="history">
</tbody>
<tbody id="history"></tbody>
</table>
<script>
async function loadData(){
let chart=null;
const response=await fetch("metrics.json");
async function loadMetrics(){
const data=await response.json();
const response=await fetch("/metrics.json");
document.getElementById("uptime").innerHTML=data.uptime+" %";
const data=await response.json();
document.getElementById("latency").innerHTML=data.last_check.latency+" ms";
document.getElementById("uptime").innerHTML=data.uptime+" %";
document.getElementById("latency").innerHTML=data.last_check.latency+" ms";
document.getElementById("dns").innerHTML=data.last_check.dns+" ms";
document.getElementById("search").innerHTML=data.last_check.search_latency+" ms";
document.getElementById("ssl").innerHTML=data.last_check.ssl_expiry;
document.getElementById("days").innerHTML=data.last_check.ssl_days_left;
document.getElementById("dns").innerHTML=data.last_check.dns+" ms";
const tbody=document.getElementById("history");
document.getElementById("search").innerHTML=data.last_check.search_latency+" ms";
tbody.innerHTML="";
document.getElementById("ssl").innerHTML=data.last_check.ssl_expiry;
[...data.history].reverse().forEach(item=>{
document.getElementById("days").innerHTML=data.last_check.ssl_days_left+" days";
tbody.innerHTML+=`
<tr>
<td>${item.time}</td>
<td class="${item.status==200?'good':'bad'}">${item.status}</td>
<td>${item.latency}</td>
<td>${item.dns}</td>
<td>${item.search_latency}</td>
<td>${item.ssl_days_left}</td>
</tr>`;
});
let tbody=document.getElementById("history");
const labels=data.latency_chart.map((_,i)=>i+1);
tbody.innerHTML="";
if(chart){
chart.destroy();
}
data.history.reverse().forEach(item=>{
chart=new Chart(document.getElementById("chart"),{
tbody.innerHTML+=`
type:"line",
<tr>
data:{
<td>${item.time}</td>
labels:labels,
<td class="${item.status==200?'good':'bad'}">
datasets:[{
${item.status}
label:"Latency (ms)",
</td>
data:data.latency_chart,
<td>${item.latency} ms</td>
borderColor:"#007bff",
<td>${item.dns} ms</td>
fill:false,
<td>${item.search_latency} ms</td>
tension:.3
<td>${item.ssl_days_left}</td>
}]
</tr>
}
`;
});
const labels=[];
for(let i=1;i<=data.latency_chart.length;i++){
labels.push(i);
});
}
new Chart(document.getElementById("latencyChart"),{
loadMetrics();
type:"line",
data:{
labels:labels,
datasets:[{
label:"Latency (ms)",
data:data.latency_chart,
fill:false,
borderWidth:2
}]
},
options:{
responsive:true,
plugins:{
legend:{
display:true
}
}
}
});
}
loadData();
setInterval(loadData,60000);
setInterval(loadMetrics,60000);
</script>