This commit is contained in:
赵鑫 2022-09-05 07:18:21 +08:00
parent 4263bf1af8
commit 894119fd9b

View File

@ -21,11 +21,11 @@ const server = http.createServer(function (request, response) {
const result = { const result = {
hostname, hostname,
cpu: { cpu: {
temperature: Number((temp_string / 1000).toFixed(3)), temperature: temp_string / 1000,
}, },
memory: { memory: {
total: Number((meminfo_total[1] / 1024).toFixed(2)), total: meminfo_total[1] / 1024,
available: Number((meminfo_available[1] / 1024).toFixed(2)) available: meminfo_available[1] / 1024,
}, },
} }
exec("cat /proc/stat |grep cpu |tail -1|awk '{print ($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10)}'|awk '{print 100 - $1}'", (err, stdout, stderr) => { exec("cat /proc/stat |grep cpu |tail -1|awk '{print ($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10)}'|awk '{print 100 - $1}'", (err, stdout, stderr) => {