mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-02-23 21:59:05 +00:00
fix: missing cpu temp and swap logic
This commit is contained in:
parent
83c6cee482
commit
bd71035517
@ -836,7 +836,9 @@ const generateStats = async (req, res) => {
|
|||||||
'CPU Load': `${currentLoad.currentLoad.toFixed(1)}%`,
|
'CPU Load': `${currentLoad.currentLoad.toFixed(1)}%`,
|
||||||
'CPUs Load': currentLoad.cpus.map(cpu => `${cpu.load.toFixed(1)}%`).join(', '),
|
'CPUs Load': currentLoad.cpus.map(cpu => `${cpu.load.toFixed(1)}%`).join(', '),
|
||||||
'CPU Temperature': {
|
'CPU Temperature': {
|
||||||
value: cpuTemperature ? cpuTemperature.main : 'Not supported',
|
value: cpuTemperature && typeof cpuTemperature.main === 'number'
|
||||||
|
? cpuTemperature.main
|
||||||
|
: 'N/A',
|
||||||
type: 'tempC' // temp value from this library is hard-coded to C
|
type: 'tempC' // temp value from this library is hard-coded to C
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
@ -847,12 +849,12 @@ const generateStats = async (req, res) => {
|
|||||||
type: 'byteUsage'
|
type: 'byteUsage'
|
||||||
},
|
},
|
||||||
Swap: {
|
Swap: {
|
||||||
value: typeof mem.swapused === 'number' && typeof mem.swaptotal === 'number'
|
value: typeof mem.swaptotal === 'number' && mem.swaptotal > 0
|
||||||
? {
|
? {
|
||||||
used: mem.swapused,
|
used: mem.swapused,
|
||||||
total: mem.swaptotal
|
total: mem.swaptotal
|
||||||
}
|
}
|
||||||
: null,
|
: 'N/A',
|
||||||
type: 'byteUsage'
|
type: 'byteUsage'
|
||||||
},
|
},
|
||||||
Uptime: {
|
Uptime: {
|
||||||
|
Loading…
Reference in New Issue
Block a user