zhao/index.html

77 lines
2.7 KiB
HTML
Raw Normal View History

2022-09-02 17:10:33 +00:00
<!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;
}
2022-09-02 18:13:31 +00:00
#rpi_status {
2022-09-02 18:23:08 +00:00
display: flex;
}
.status_windows {
flex: 1 1 auto;
2022-09-02 18:13:31 +00:00
}
2022-09-02 17:10:33 +00:00
</style>
</head>
<body>
<h1><img src="favicon.ico">赵家小站</h1>
<nav>
<a class="button" href="课程表.html">课程表</a>
2022-09-02 17:12:12 +00:00
<a class="button" href="小学阶段必背古诗词.html">必背诗词</a>
2022-09-04 15:34:29 +00:00
<a class="button" href="/~xin/">老爸</a>
2022-09-02 17:10:33 +00:00
<a class="button" href="/~jun/">鱼儿</a>
<a class="button" href="/~yang/">海洋</a>
<a class="button" href="http://nas:3000/">代码仓库</a>
2022-09-04 16:43:22 +00:00
<a class="button" href="/sensehat/">Sense HAT</a>
2022-09-02 17:10:33 +00:00
</nav>
2022-09-02 18:13:31 +00:00
<div id="rpi_status">
<div class='status_windows' id="zhao_status">
2022-09-02 18:23:08 +00:00
<p>主机zhao <img src="images/rpi_logo.png" height=64></p>
2022-09-02 18:13:31 +00:00
<p>核心温度:<span id="zhao_temp"></span></p>
<p>CPU负载<span id="zhao_cpu"></span> %</p>
<p>内存剩余:<span id="zhao_mem"></span> MB</p>
2022-09-04 07:07:40 +00:00
<p><a class="button" href="http://zhao/status" target="_blank">JSON数据</a></p>
2022-09-02 18:13:31 +00:00
</div>
<div class='status_windows' id="pi_status">
2022-09-02 18:23:08 +00:00
<p>主机pi <img src="images/rpi_logo.png" height=64></p>
2022-09-02 18:13:31 +00:00
<p>核心温度:<span id="pi_temp"></span></p>
<p>CPU负载<span id="pi_cpu"></span> %</p>
<p>内存剩余:<span id="pi_mem"></span> MB</p>
2022-09-04 07:07:40 +00:00
<p><a class="button" href="http://pi/status" target="_blank">JSON数据</a></p>
2022-09-02 18:13:31 +00:00
</div>
</div>
<script>
function getinfo(url) {
2022-09-04 07:05:46 +00:00
fetch(new Request('http://zhao/status'))
2022-09-02 18:13:31 +00:00
.then(res => res.json())
.then(data => {
2022-09-04 05:38:34 +00:00
zhao_temp.innerText = data.cpu.temperature.toFixed(2)
2022-09-03 06:27:30 +00:00
zhao_cpu.innerText = (data.cpu.load * 100).toFixed(2)
2022-09-04 05:38:34 +00:00
zhao_mem.innerText = data.memory.available.toFixed(2)
2022-09-02 18:13:31 +00:00
})
2022-09-04 07:05:46 +00:00
fetch(new Request('http://pi/status'))
2022-09-02 18:13:31 +00:00
.then(res => res.json())
.then(data => {
2022-09-04 05:38:34 +00:00
pi_temp.innerText = data.cpu.temperature.toFixed(2)
2022-09-03 06:27:30 +00:00
pi_cpu.innerText = (data.cpu.load * 100).toFixed(2)
2022-09-04 05:38:34 +00:00
pi_mem.innerText = data.memory.available.toFixed(2)
2022-09-02 18:13:31 +00:00
})
}
setInterval(getinfo, 1000)
</script>
2022-09-02 17:10:33 +00:00
</body>
</html>