fix array combine for sensors with non uniform data
This commit is contained in:
parent
04620e6082
commit
7ace8136a6
|
@ -56,7 +56,11 @@ function ipmi_sensors($options) {
|
||||||
foreach($output as $line){
|
foreach($output as $line){
|
||||||
|
|
||||||
// add sensor keys as keys to ipmitool output
|
// add sensor keys as keys to ipmitool output
|
||||||
$sensor = array_combine($keys, array_slice(explode(",", $line),0,18,true));
|
$sensor_raw = explode(",", $line);
|
||||||
|
$size_raw = sizeof($sensor_raw);
|
||||||
|
$sensor = ($size_raw < 18) ? []:
|
||||||
|
/*array_combine(array_slice($keys,0,$size_raw,true), $sensor_raw)*/
|
||||||
|
array_combine($keys, array_slice($sensor_raw,0,18,true));
|
||||||
|
|
||||||
// add sensor to array of sensors
|
// add sensor to array of sensors
|
||||||
$sensors[] = $sensor;
|
$sensors[] = $sensor;
|
||||||
|
@ -154,5 +158,5 @@ function ipmi_get_fans($sensors){
|
||||||
}
|
}
|
||||||
return $fans;
|
return $fans;
|
||||||
}
|
}
|
||||||
|
//echo json_encode($ipmi_sensors);
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user