trying to get cpu temperature systeminformation npm library

567 views Asked by At

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 }
1

There are 1 answers

0
Pratheek Reddy On BEST ANSWER

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