sidicer / lm-sensors-php Goto Github PK
View Code? Open in Web Editor NEWlm-sensors reading in parsed through PHP
lm-sensors reading in parsed through PHP
I try to use your script. Executing
<?php
include_once('readsensors.php');
$cpu_temp = read_sensors();
print_r($cpu_temp[0]['temp1']['input']);
?>
leads to error:
PHP Warning: Undefined array key "temp1" in read_sensors.php on line 56
PHP Warning: Trying to access array offset on value of type null in read_sensors.php on line 56
$ sensors -u
gives:
w83795adg-i2c-1-2f
Adapter: SMBus PIIX4 adapter port 2 at 0b00
Vcore:
in0_input: 0.718
in0_min: 0.500
in0_max: 1.400
in0_alarm: 0.000
Vdimm:
in1_input: 1.512
in1_min: 1.424
in1_max: 1.574
in1_alarm: 0.000
+3.3V:
in12_input: 3.282
in12_min: 2.964
in12_max: 3.630
in12_alarm: 0.000
3VSB:
in13_input: 3.204
in13_min: 2.964
in13_max: 3.630
in13_alarm: 0.000
Array Fan:
fan1_input: 668.000
fan1_min: 329.000
fan1_alarm: 0.000
CPU Temp:
temp1_input: 18.000
temp1_max: 109.000
temp1_max_hyst: 109.000
temp1_crit: 109.000
temp1_crit_hyst: 109.000
temp1_alarm: 0.000
temp1_type: 3.000
NB Temp:
temp2_input: 27.000
temp2_max: 105.000
temp2_max_hyst: 105.000
temp2_crit: 105.000
temp2_crit_hyst: 105.000
temp2_alarm: 0.000
temp2_type: 3.000
MB Temp:
temp5_input: 3.000
temp5_max: 39.000
temp5_max_hyst: 39.000
temp5_crit: 44.000
temp5_crit_hyst: 44.000
temp5_alarm: 0.000
temp5_type: 4.000
jc42-i2c-0-18
Adapter: SMBus PIIX4 adapter port 0 at 0b00
RAM1 Temp:
temp1_input: 13.250
temp1_max: 60.000
temp1_max_hyst: 54.000
temp1_min: 0.000
temp1_crit: 70.000
temp1_crit_hyst: 64.000
temp1_max_alarm: 0.000
temp1_min_alarm: 0.000
temp1_crit_alarm: 0.000
k10temp-pci-00c3
Adapter: PCI adapter
CPU Core Temp:
temp1_input: 24.625
temp1_max: 70.000
temp1_crit: 100.000
temp1_crit_hyst: 95.000
jc42-i2c-0-19
Adapter: SMBus PIIX4 adapter port 0 at 0b00
RAM2 Temp:
temp1_input: 13.000
temp1_max: 60.000
temp1_max_hyst: 54.000
temp1_min: 0.000
temp1_crit: 70.000
temp1_crit_hyst: 64.000
temp1_max_alarm: 0.000
temp1_min_alarm: 0.000
temp1_crit_alarm: 0.000
What may be wrong?
UPD: it works, though needs more explanation in particular in regard of categories or labels.
In my case it is print_r($cpu_temp[0]['CPU Temp']['temp1_input']);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.