rename variables

This commit is contained in:
Derek Macias 2016-02-05 23:10:30 -07:00
parent 36a592e517
commit db65f2f463
2 changed files with 11 additions and 11 deletions

View File

@ -19,9 +19,9 @@ $ipaddr = preg_match('/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[
$cfg['IPADDR'] : $cfg['IPADDR'] :
trim(shell_exec("/usr/bin/ipmitool lan print | grep 'IP Address ' | sed -n -e 's/^.*: //p'")); trim(shell_exec("/usr/bin/ipmitool lan print | grep 'IP Address ' | sed -n -e 's/^.*: //p'"));
$cpu = isset($cfg['CPU_TEMP']) ? $cfg['CPU_TEMP'] : ""; // cpu temp display name $cpu_temp = isset($cfg['CPU_TEMP']) ? $cfg['CPU_TEMP'] : ""; // cpu temp display name
$mb = isset($cfg['MB_TEMP']) ? $cfg['MB_TEMP'] : ""; // mb temp display name $mb_temp = isset($cfg['MB_TEMP']) ? $cfg['MB_TEMP'] : ""; // mb temp display name
$fan = isset($cfg['IPMI_FAN']) ? $cfg['IPMI_FAN'] : ""; // fan speed display name $fan_disp = isset($cfg['FAN_DISP']) ? $cfg['FAN_DISP'] : ""; // fan speed display name
$user = isset($cfg['USER']) ? $cfg['USER'] : ""; // user for remote access $user = isset($cfg['USER']) ? $cfg['USER'] : ""; // user for remote access
$password = isset($cfg['PASSWORD']) ? $cfg['PASSWORD'] : ""; // password for remote access $password = isset($cfg['PASSWORD']) ? $cfg['PASSWORD'] : ""; // password for remote access

View File

@ -5,18 +5,18 @@ function ipmi_temp($reading, $unit, $dot) {
return ($reading>0 ? ($unit=='F' ? round(9/5*$reading+32) : str_replace('.',$dot,$reading)) : '##')." $unit"; return ($reading>0 ? ($unit=='F' ? round(9/5*$reading+32) : str_replace('.',$dot,$reading)) : '##')." $unit";
} }
if ($cpu || $mb || $fan){ if ($cpu_temp || $mb_temp || $fan_disp){
$readings = ipmi_get_reading([$cpu, $mb, $fan], $options); $readings = ipmi_get_reading([$cpu_temp, $mb_temp, $fan_disp], $options);
$temps = []; $temps = [];
if ($readings[$cpu]) if ($readings[$cpu_temp])
$temps[] = "<img src='/plugins/$plugin/icons/cpu.png' title='$cpu' class='icon'>".ipmi_temp($readings[$cpu], $_GET['unit'], $_GET['dot']); $temps[] = "<img src='/plugins/$plugin/icons/cpu.png' title='$cpu_temp' class='icon'>".ipmi_temp($readings[$cpu_temp], $_GET['unit'], $_GET['dot']);
if ($readings[$mb]) if ($readings[$mb_temp])
$temps[] = "<img src='/plugins/$plugin/icons/mb.png' title='$mb' class='icon'>".ipmi_temp($readings[$mb], $_GET['unit'], $_GET['dot']); $temps[] = "<img src='/plugins/$plugin/icons/mb.png' title='$mb_temp' class='icon'>".ipmi_temp($readings[$mb_temp], $_GET['unit'], $_GET['dot']);
if ($readings[$fan]) if ($readings[$fan_disp])
$temps[] = "<img src='/plugins/$plugin/icons/fan.png' title='$fan' class='icon'>".$readings[$fan]."&thinsp;rpm"; $temps[] = "<img src='/plugins/$plugin/icons/fan.png' title='$fan_disp' class='icon'>".$readings[$fan_disp]."&thinsp;rpm";
} }
if ($temps) if ($temps)
echo "<span id='temps' style='margin-right:16px'>".implode('&nbsp;', $temps)."</span>"; echo "<span id='temps' style='margin-right:16px'>".implode('&nbsp;', $temps)."</span>";