This commit is contained in:
赵鑫 2022-09-08 10:03:54 +08:00
parent 0ae20916cc
commit 24e0729fe6

View File

@ -6,7 +6,7 @@ const fs = require('fs')
const http = require('http') const http = require('http')
const exec = require('child_process').exec const exec = require('child_process').exec
const port = process.env.PORT || 3000 const port = process.env.PORT || 3000
const hostname = process.env.hostname || 'localhost' const hostname = require('os').hostname()
const MEMINFO_FILE_PATH = '/proc/meminfo' const MEMINFO_FILE_PATH = '/proc/meminfo'
const TEMPERATURE_FILE_PATH = '/sys/class/thermal/thermal_zone0/temp' const TEMPERATURE_FILE_PATH = '/sys/class/thermal/thermal_zone0/temp'
const status = { hostname, cpu: { temperature: 0, load: 0 }, memory: { total: 0, available: 0 }, error: null } const status = { hostname, cpu: { temperature: 0, load: 0 }, memory: { total: 0, available: 0 }, error: null }