node.jslinuxnpmamazon-ec2system-information

trying to get cpu temperature systeminformation npm library


im trying to get CPU temperature using systeminformation in node.js, but getting null values in the output. i also installed sensors before getting cpu information

this application is running on AWS EC2 instance

import si from 'systeminformation'
import { execSync } from 'child_process'

let output=execSync('sudo apt-get install lm-sensors')
const temperature = await si.cpuTemperature()
console.log(temperature)

output:

{ main: null, cores: [], max: null, socket: [], chipset: null }

Solution

  • AWS EC2 won't disclose its CPU temperature. But this should work in any local machine.