Skip to content

Commit

Permalink
add extra linux sensors
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Smith <[email protected]>
  • Loading branch information
si458 committed Oct 16, 2023
1 parent 4a2656f commit 32e087e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions agents/modules_meshcore/sysinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@ function linux_thermals()
ret.push({CurrentTemperature: (parseFloat(line[0])/1000), InstanceName: line[1]});
}
}
child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
child.stdin.write("for mon in /sys/class/hwmon/hwmon*; do for label in \"$mon\"/temp*_label; do if [ -f $label ]; then echo $(cat \"$label\")___$(cat \"${label%_*}_input\"); fi; done; done;\nexit\n");
child.waitExit();
if(child.stdout.str.trim()!='')
{
var lines = child.stdout.str.trim().split('\n');
for (var i = 0; i < lines.length; ++i)
{
var line = lines[i].trim().split('___');
ret.push({ CurrentTemperature: (parseFloat(line[1])/1000), InstanceName: line[0] });
}
}
return (ret);
}

Expand Down

0 comments on commit 32e087e

Please sign in to comment.