Files
webgui/plugins/dynamix/DeviceInfo.page

475 lines
21 KiB
Plaintext

Menu="Device:1"
Title="$name Settings"
Png="devicesettings.png"
---
<?PHP
/* Copyright 2015, Lime Technology
* Copyright 2015, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
require_once "$docroot/webGui/include/Preselect.php";
$disk = &$disks[$name];
$events = isset($disk['smEvents']) ? explode('|',$disk['smEvents']) : (isset($var['smEvents']) ? explode('|',$var['smEvents']) : $numbers);
function displayTemp($temp) {
global $display;
return $display['unit']=='F' ? round(9/5*$temp)+32 : $temp;
}
?>
<script>
function doDispatch(form) {
var fields = {};
<?if ($display['unit']=='F'):?>
if (form.<?=$name?>_hotTemp.value>0) form.<?=$name?>_hotTemp.value = Math.round((form.<?=$name?>_hotTemp.value-32)*5/9);
if (form.<?=$name?>_maxTemp.value>0) form.<?=$name?>_maxTemp.value = Math.round((form.<?=$name?>_maxTemp.value-32)*5/9);
<?endif;?>
fields['#cfg'] = "/boot/config/smart-one.cfg";
$(form).find('input[name^="<?=$name?>_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
$.post('/webGui/include/Dispatcher.php',fields);
}
function prepareDeviceInfo(form) {
var events = [];
for (var i=0; i < <?=count($preselect)?>; i++) {
if (form.elements['at'+i].checked) events.push(form.elements['at'+i].value);
form.elements['at'+i].disabled = true;
}
var custom = form.smCustom.value.trim();
var custom = custom.length ? custom.split(',') : [];
for (var i=0; i < custom.length; i++) events.push(custom[i].trim());
form.smEvents.value = events.join('|');
}
function setGlue(form) {
var data = [{glue:'' ,more:0},
{glue:'' ,more:0},
{glue:'' ,more:0},
{glue:',',more:1,min1:0,max1:127},
{glue:'/',more:2,min1:1,max1:128,min2:1,max2:8},
{glue:'/',more:3,min1:1,max1:4,min2:1,max2:128,min3:1,max3:4},
{glue:'' ,more:0},
{glue:',',more:1,min1:0,max1:127}
];
var n = form.smType.selectedIndex > 0 ? form.smType.selectedIndex-1 : <?=isset($var['smIndex'])?$var['smIndex']:0?>;
var x = data[n]['more'];
for (var i=1; i <= x; i++) $('input[name="smPort'+i+'"]').attr('placeholder',data[n]['min'+i]+'..'+data[n]['max'+i]).show();
for (var i=x+1; i <= 3; i++) $('input[name="smPort'+i+'"]').val('').hide();
if (x > 0) {
$('#devtext').show();
$('input[name="smDevice"]').show();
$('#helptext').show();
} else {
$('#devtext').hide();
$('input[name="smDevice"]').val('').hide();
$('#helptext').hide();
}
}
$(function() {
var form = document.smart_settings;
<?if (!isset($disk['smType'])):?>
form.smType.selectedIndex = 0;
<?endif;?>
setGlue(form);
});
</script>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onsubmit="doDispatch(this)">
Name:
: <big><?=my_disk($name)?></big>
Partition size:
: <?=my_number($disk['size'])?> KB (K=1024)
Partition format:
: <?=$disk['format']?>
<?if ($disk['type']!="Parity"):?>
<?if ($disk['type']=="Data" || $disk['name']=="cache"):?>
Comments:
: <input type="text" name="diskComment.<?=$disk['idx'];?>" maxlength="256" value="<?=$disk['comment']?>">
> This text will appear under the *Comments* column for the share in Windows Explorer.
> Enter anything you like, up to 256 characters.
<?endif;?>
File system status:
: <?=$disk['fsStatus']?><?if ($disk['fsError']) echo " - {$disk['fsError']}";?>&nbsp;
<?endif;?>
<?if ($disk['type']=="Data" || ($disk['type']=="Cache" && $var['SYS_CACHE_SLOTS']==1)):?>
<?if ($var['fsState']=="Stopped"):?>
File system type:
: <select name="diskFsType.<?=$disk['idx'];?>" size="1">
<?=mk_option($disk['fsType'], "auto", "auto")?>
<?=mk_option($disk['fsType'], "btrfs", "btrfs")?>
<?=mk_option($disk['fsType'], "reiserfs", "reiserfs")?>
<?=mk_option($disk['fsType'], "xfs", "xfs")?>
</select>
<?else:?>
File system type:
: <select name="diskFsType.<?=$disk['idx'];?>" size="1" disabled>
<?=mk_option($disk['fsType'], "auto", "auto")?>
<?=mk_option($disk['fsType'], "btrfs", "btrfs")?>
<?=mk_option($disk['fsType'], "reiserfs", "reiserfs")?>
<?=mk_option($disk['fsType'], "xfs", "xfs")?>
</select> Array must be **Stopped** to change
<?endif;?>
<?elseif ($disk['type']=="Cache" && $var['SYS_CACHE_SLOTS']>1):?>
File system type:
: <?=$disk['fsType'];?>&nbsp;
<?endif;?>
Spin down delay:
: <select name="diskSpindownDelay.<?=$disk['idx']?>" size="1">
<?=mk_option($disk['spindownDelay'], "-1", "Use default")?>
<?=mk_option($disk['spindownDelay'], "0", "Never")?>
<?=mk_option($disk['spindownDelay'], "15", "15 minutes")?>
<?=mk_option($disk['spindownDelay'], "30", "30 minutes")?>
<?=mk_option($disk['spindownDelay'], "45", "45 minutes")?>
<?=mk_option($disk['spindownDelay'], "1", "1 hour")?>
<?=mk_option($disk['spindownDelay'], "2", "2 hours")?>
<?=mk_option($disk['spindownDelay'], "3", "3 hours")?>
<?=mk_option($disk['spindownDelay'], "4", "4 hours")?>
<?=mk_option($disk['spindownDelay'], "5", "5 hours")?>
<?=mk_option($disk['spindownDelay'], "6", "6 hours")?>
<?=mk_option($disk['spindownDelay'], "7", "7 hours")?>
<?=mk_option($disk['spindownDelay'], "8", "8 hours")?>
<?=mk_option($disk['spindownDelay'], "9", "9 hours")?>
</select><span id="smart_selftest" class='orange-text'></span>
<?if ($disk['type'] != 'Parity'):?>
Warning disk utilization threshold (%):
: <input type="number" min="0" max="100" name="<?=$name?>_warning" class="narrow" value="<?=strlen($disk['warning'])?$disk['warning']:''?>" placeholder="<?=$display['warning']?>">
> *Warning disk utilization* sets the warning threshold for this hard disk utilization. Exceeding this threshold will result in a warning notification.
>
> When the warning threshold is set equal or greater than the critical threshold, there will be only critical notifications (warnings are not existing).
>
> A value of zero will disable the warning threshold (including notifications).
Critical disk utilization threshold (%):
: <input type="number" min="0" max="100" name="<?=$name?>_critical" class="narrow" value="<?=strlen($disk['critical'])?$disk['critical']:''?>" placeholder="<?=$display['critical']?>")>
> *Critical disk utilization* sets the critical threshold for this hard disk utilization. Exceeding this threshold will result in an alert notification.
>
> A value of zero will disable the critical threshold (including notifications).
<?endif;?>
Warning disk temperature threshold (&deg;<?=$display['unit']?>):
: <input type="number" min="0" max="300" name="<?=$name?>_hotTemp" class="narrow" value="<?=strlen($disk['hotTemp'])?displayTemp($disk['hotTemp']):''?>" placeholder="<?=displayTemp($display['hot'])?>">
> *Warning disk temperature* sets the warning threshold for this hard disk temperature. Exceeding this threshold will result in a warning notification.
>
> A value of zero will disable the warning threshold (including notifications).
Critical disk temperature threshold (&deg;<?=$display['unit']?>):
: <input type="number" min="0" max="300" name="<?=$name?>_maxTemp" class="narrow" value="<?=strlen($disk['maxTemp'])?displayTemp($disk['maxTemp']):''?>" placeholder="<?=displayTemp($display['max'])?>">
> *Critical disk temperature* sets the critical threshold for this hard disk temperature. Exceeding this threshold will result in an alert notification.
>
> A value of zero will disable the critical threshold (including notifications).
<?if (($var['spinupGroups']=="yes")&&($disk['name']!="cache")):?>
Spinup group(s):
: <input type="text" name="diskSpinupGroup.<?=$disk['idx'];?>" maxlength="256" value="<?=$disk['spinupGroup']?>">
<?endif;?>
&nbsp;
: <input type="submit" name="changeDisk" value="Apply"><input type="button" value="Done" onclick="done()">
</form>
<?if ($name=="cache" && $var['SYS_CACHE_SLOTS']>1):?>
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/poolinformation.png" class="icon">Pool Information</span></div>
btrfs filesystem show:
: <?echo "<pre>".shell_exec("/sbin/btrfs filesystem show {$disk['uuid']}")."</pre>";?>
<?if ($disk['fsStatus']=="Mounted"):?>
btrfs filesystem df:
: <?echo "<pre>".shell_exec("/sbin/btrfs filesystem df /mnt/{$disk['name']}")."</pre>";?>
<?endif;?>
<?if ($var['cacheSbNumDisks']>1):?>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<?if ($disk['fsStatus']=="Mounted"):?>
<?exec("/usr/local/emhttp/webGui/scripts/btrfs_balance status /mnt/{$disk['name']}", $balance_status, $retval);?>
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/balancestatus.png" class="icon">Balance Status</span></div>
btrfs balance status:
: <?echo "<pre>" . implode("\n", $balance_status) . "</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_balance">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
&nbsp;
: <input type="submit" value="Balance"><input type="text" name="#arg[3]" maxlength="256" value="-dconvert=raid1 -mconvert=raid1"> Options (see Help)
> **Balance** will run the *btrfs balance* program to restripe the extents across all pool devices.
>
> The default *Options* are appropriate for btrfs-raid1. Do not change this unless you know what you are doing!
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_balance">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the balance operation in progress.
<?endif;?>
<?else:?>
&nbsp;
: <input type="submit" value="Balance" disabled>
> **Balance** is only available when the Device is Mounted.
<?endif;?>
</form>
<?endif;?>
<?endif;?>
<?if ($disk['fsType']=="btrfs"):?>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<?if ($disk['fsStatus']=="Mounted"):?>
<?exec("/usr/local/emhttp/webGui/scripts/btrfs_scrub status /mnt/{$disk['name']}", $scrub_status, $retval);?>
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/scrubstatus.png" class="icon">Scrub Status</span></div>
btrfs scrub status:
: <?echo "<pre>" . implode("\n", $scrub_status) . "</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_scrub">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
<input type="hidden" name="#arg[3]" value="-r">
&nbsp;
: <input type="submit" value="Scrub"><label><input type="checkbox" name="#arg[3]" value=""> Correct file system errors</label>
> **Scrub** runs the *btrfs scrub* program to check file system integrity.
>
> If repair is needed you should check the *Correct file system errors* and run a second Scrub pass; this will permit *btrfs scrub* to fix the file system.
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_scrub">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the Scrub operation in progress.
<?endif;?>
<?else:?>
&nbsp;
: <input type="submit" value="Scrub" disabled>
> **Scrub** is only available when the Device is Mounted.
<?endif;?>
</form>
<?endif;?>
<?if ($disk['fsType']=="reiserfs"):?>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
<?exec("/usr/local/emhttp/webGui/scripts/reiserfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/filesystemstatus.png" class="icon">Check Filesystem Status</span></div>
reiserfsck status:
: <?echo "<pre>" . implode("\n", $check_status) . "</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/reiserfs_check">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="submit" value="Check"><input type="text" name="#arg[4]" maxlength="256" value=""> Options (see Help)
> **Check Filesystem** will run the *reiserfsck* program to check file system integrity on the device.
>
> The *Options* field may be filled in with specific options used to fix problems in the file system. Typically, you
> first run a Check Filesytem pass leaving *Options* blank. Upon completion, if *reiserfsck* finds any problems, you must
> run a second Check Filesystem pass, using a specific option as instructed by the first *reiserfsck* pass.
>
> After starting a Check Filesystem, you should Refresh to monitor progress and status. Depending on
> how large the file system is, and what errors might be present, the operation can take **a long time** to finish (hours).
> Not much info is printed in the window, but you can verify the operation is running by observing the read/write counters
> increasing for the device on the Main page.
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/reiserfs_check">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the Check Filesystem operation in progress.
<?endif;?>
<?else:?>
&nbsp;
: <input type="submit" value="Check" disabled>
> **Check Fileystem** is only available when array is Started in **Mainenance** mode.
<?endif;?>
</form>
<?endif;?>
<?if ($disk['fsType']=="xfs"):?>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
<?exec("/usr/local/emhttp/webGui/scripts/xfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/filesystemstatus.png" class="icon">Check Filesystem Status</span></div>
xfs_repair status:
: <?echo "<pre>" . implode("\n", $check_status) . "</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/xfs_check">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="submit" value="Check"><input type="text" name="#arg[4]" maxlength="256" value="-n"> Options (see Help)
> **Check Filesystem** will run the *xfs_repair* program to check file system integrity on the device.
>
> The *Options* field is initialized with *-n* which specifies check-only. If repair is needed, you should run
> a second Check Filesystem pass, setting the *Options* blank; this will permit *xfs_repair* to fix the file system.
>
> After starting a Check Filesystem, you should Refresh to monitor progress and status. Depending on
> how large the file system is, and what errors might be present, the operation can take **a long time** to finish (hours).
> Not much info is printed in the window, but you can verify the operation is running by observing the read/write counters
> increasing for the device on the Main page.
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/xfs_check">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the Check Filesystem operation in progress.
<?endif;?>
<?else:?>
&nbsp;
: <input type="submit" value="Check" disabled>
> **Check Fileystem** is only available when array is Started in **Mainenance** mode.
<?endif;?>
</form>
<?endif;?>
<div id="title"><span class="left"><img src="/webGui/icons/smartchecks.png" class="icon">SMART Settings</span></div>
<form markdown="1" name="smart_settings" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareDeviceInfo(this)">
<input type="hidden" name="#file" value="/boot/config/smart-one.cfg">
<input type="hidden" name="#include" value="webGui/include/update.smart.php">
<input type="hidden" name="#section" value="<?=$name?>">
<input type="hidden" name="smEvents" value="">
<input type="hidden" name="smGlue" value="<?=$var['smGlue']?>">
SMART notification value:
: <select name="smSelect" size="1">
<?=mk_option($disk['smSelect'], "-1", "Use default")?>
<?=mk_option($disk['smSelect'], "0", "Raw")?>
<?=mk_option($disk['smSelect'], "1", "Normalized")?>
</select>
> SMART notifications are generated on either an increasing RAW value of the attribute, or a decreasing NORMALIZED value which reaches a predefined threshold set by the manufacturer.
>
> Each disk may have its own specific setting overruling the 'default' setting (see global SMART settings under Disk Settings).
SMART notification tolerance level:
: <select name="smLevel" size="1">
<?=mk_option($disk['smLevel'], "-1", "Use default")?>
<?=mk_option($disk['smLevel'], "1.00", "Absolute")?>
<?=mk_option($disk['smLevel'], "1.05", "5%")?>
<?=mk_option($disk['smLevel'], "1.10", "10%")?>
<?=mk_option($disk['smLevel'], "1.15", "15%")?>
<?=mk_option($disk['smLevel'], "1.20", "20%")?>
<?=mk_option($disk['smLevel'], "1.25", "25%")?>
<?=mk_option($disk['smLevel'], "1.50", "50%")?>
</select>
> A tolerance level may be given to prevent that small changes result in a notification. Setting a too high tolerance level may result in critical changes without a notification.
>
> Each disk may have its own specific setting overruling the 'default' setting (see global SMART settings under Disk Settings).
SMART controller type:
: <select name="smType" size="1" onchange="setGlue(this.form)">
<?=mk_option($disk['smType'], "-1", "Use default")?>
<?=mk_option($disk['smType'], "", "Automatic")?>
<?=mk_option($disk['smType'], "-d ata", "ATA")?>
<?=mk_option($disk['smType'], "-d scsi", "SCSI")?>
<?=mk_option($disk['smType'], "-d 3ware", "3Ware")?>
<?=mk_option($disk['smType'], "-d areca", "Areca")?>
<?=mk_option($disk['smType'], "-d hpt", "HighPoint")?>
<?=mk_option($disk['smType'], "-d marvell", "Marvell")?>
<?=mk_option($disk['smType'], "-d megaraid", "MegaRAID")?>
</select>
<input type="text" name="smPort1" maxlength="3" value="<?=$disk['smPort1']?>" style="display:none;width:32px">
<input type="text" name="smPort2" maxlength="3" value="<?=$disk['smPort2']?>" style="display:none;width:32px">
<input type="text" name="smPort3" maxlength="3" value="<?=$disk['smPort3']?>" style="display:none;width:32px"><span id="devtext" style="display:none;font-weight:bold">/dev/</span>
<input type="text" name="smDevice" value="<?=isset($disk['smDevice'])?$disk['smDevice']:''?>" style="display:none;width:32px" placeholder="<?=$disk['device']?>"><span id="helptext" style="display:none;font-style:italic">enter disk index and device name as applicable to your controller</span>
> By default automatic controller selection is done by smartctl to read the SMART information. Certain controllers however need specific settings for smartctl to work.
> Use this setting to select your controller type and fill-in the specific disk index and device name for your situation. Use the manufacturer's documentation to find the relevant information.
>
> Each disk may have its own specific setting overruling the 'default' setting (see global SMART settings under Disk Settings).
SMART attribute notifications:
: <input type="text" name="smCustom" value="<?=isset($disk['smCustom'])?$disk['smCustom']:$var['smCustom']?>" class="narrow">Custom attributes (use comma to separate numbers)
<?for ($x = 0; $x < count($preselect); $x++):?>
&nbsp;
: <input type="checkbox" name="at<?=$x?>" value="<?=$preselect[$x]['code']?>"<?=in_array($preselect[$x]['code'],$events)?' checked':''?>><span style="display:inline-block;width:136px"><?=$preselect[$x]['code']?></span><?=$preselect[$x]['text']?>
<?endfor;?>
> The user can enable or disable notifications for the given SMART attributes. It is recommended to keep the default, which is ALL selected attributes,
> when certain attributes are not present on your hard disk or do not provide the correct information, these may be excluded.
> In addition custom SMART attributes can be entered to generate notifications. Be careful in this selection,
> it may cause an avalance of notifcations if inappropriate SMART attributes are chosen.
>
> Each disk may have its own specific setting overruling the 'default' setting (see global SMART settings under Disk Settings).
<input type="submit" name="#default" value="Default">
: <input type="submit" name="#apply" value="Apply"><input type="button" value="Done" onclick="done()">
</form>