76 lines
2.5 KiB
HTML
76 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<link rel="stylesheet" href="/style/zhao.css">
|
||
<title>赵家小站</title>
|
||
<style>
|
||
nav {
|
||
display: flex;
|
||
gap: 1rem;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
#rpi_status {
|
||
display: flex;
|
||
}
|
||
|
||
.status_windows {
|
||
flex: 1 1 auto;
|
||
}
|
||
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<h1><img src="favicon.ico">赵家小站</h1>
|
||
<nav>
|
||
<a class="button" href="课程表.html">课程表</a>
|
||
<a class="button" href="小学阶段必背古诗词.html">必背诗词</a>
|
||
<a class="button" href="/~xin/">爸爸</a>
|
||
<a class="button" href="/~jun/">鱼儿</a>
|
||
<a class="button" href="/~yang/">海洋</a>
|
||
<a class="button" href="http://nas:3000/">代码仓库</a>
|
||
</nav>
|
||
<div id="rpi_status">
|
||
<div class='status_windows' id="zhao_status">
|
||
<p>主机:zhao <img src="images/rpi_logo.png" height=64></p>
|
||
<p>核心温度:<span id="zhao_temp"></span> ℃</p>
|
||
<p>CPU负载:<span id="zhao_cpu"></span> %</p>
|
||
<p>内存剩余:<span id="zhao_mem"></span> MB</p>
|
||
</div>
|
||
<div class='status_windows' id="pi_status">
|
||
<p>主机:pi <img src="images/rpi_logo.png" height=64></p>
|
||
<p>核心温度:<span id="pi_temp"></span> ℃</p>
|
||
<p>CPU负载:<span id="pi_cpu"></span> %</p>
|
||
<p>内存剩余:<span id="pi_mem"></span> MB</p>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function getinfo(url) {
|
||
fetch(new Request('http://zhao:4000'))
|
||
.then(res => res.json())
|
||
.then(data => {
|
||
// console.table(data)
|
||
zhao_temp.innerText = data.cpu.temperature
|
||
zhao_cpu.innerText = (data.cpu.load * 100).toFixed(2)
|
||
zhao_mem.innerText = data.memory.available
|
||
})
|
||
fetch(new Request('http://pi:4000'))
|
||
.then(res => res.json())
|
||
.then(data => {
|
||
// console.table(data)
|
||
pi_temp.innerText = data.cpu.temperature
|
||
pi_cpu.innerText = (data.cpu.load * 100).toFixed(2)
|
||
pi_mem.innerText = data.memory.available
|
||
})
|
||
}
|
||
setInterval(getinfo, 1000)
|
||
</script>
|
||
</body>
|
||
|
||
</html>
|