diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page index f94154a4f..496a9ebd5 100644 --- a/plugins/dynamix/ArrayOperation.page +++ b/plugins/dynamix/ArrayOperation.page @@ -159,7 +159,7 @@ function parityStatus() { if (data) {$.each(data.split(';'),function(k,v) {if ($('#line'+k).length>0) $('#line'+k).html(v);});} timers.parityStatus = setTimeout(parityStatus,3000); if (!data && $('#cancelButton').length>0 && $('#cancelButton').val()=='Cancel') { - $('#cancelButton').val('Done').unbind().bind({click:function(){refresh();}}); + $('#cancelButton').val('Done').prop('onclick',null).off('click').click(function(){refresh();}); $('#cancelText').html(''); $('#line4').html('completed'); } @@ -181,6 +181,16 @@ function stopParity(form,text) { form.submit(); } +function pauseParity(form) { + $(form).append(''); + $('#pauseButton').val('Resume').prop('onclick',null).off('click').click(function(){resumeParity(form);}); + form.submit(); +} +function resumeParity(form) { + $(form).append(''); + $('#pauseButton').val('Pause').prop('onclick',null).off('click').click(function(){pauseParity(form);}); + form.submit(); +} function shutdown_now(form,cmd) { $(form).append(''); @@ -196,7 +206,7 @@ parityStatus(); $('.tabs').append(ctrl); if ($.cookie('tab')=='tab0') $('i.toggle').hide(); -$('#tab'+$('input[name$="tabs"]').length).bind({click:function() {tab0(); $('i.toggle').hide('slow');}}); +$('#tab'+$('input[name$="tabs"]').length).click(function(){tab0(); $('i.toggle').hide('slow');}); $('div[id=title]:not(":last, .disable_diskio")').each(function(){$(this).append(ctrl);}); @@ -230,7 +240,7 @@ $(function(){ -0 ? '
Disabled -- Parity operation is running' : ''; +Disabled -- Parity operation is running' : ''; $mover = file_exists('/var/run/mover.pid') ? '
Disabled -- Mover is running' : ''; $btrfs = exec('pgrep -cf /sbin/btrfs') ? '
Disabled -- BTRFS operation is running' : ''; switch ($var['fsState']): @@ -248,7 +258,7 @@ $(function(){ Yes I want to do this All data is permanently lost !!!
This is not used to recover data

Format is never part of a rebuild
@@ -291,17 +301,25 @@ $(function(){ endif; else: if ($var['mdResyncAction']=="check"):?> - + - + - + - + diff --git a/plugins/dynamix/SyslogSettings.page b/plugins/dynamix/SyslogSettings.page new file mode 100644 index 000000000..0e08a8366 --- /dev/null +++ b/plugins/dynamix/SyslogSettings.page @@ -0,0 +1,90 @@ +Menu="NetworkServices" +Title="Syslog Server" +Icon="icon-eula" +Tag="file-text-o" +--- + + + + + + + + + +Local syslog server: +: + + + +> Let the server act as a central syslog server and collect syslog messages from other systems. +> The server can listen on UDP, TCP or both with a selectable port number. +> +> Syslog information is stored per IP address. That is every system gets its own syslog file. + + + +Remote syslog server: +: + + + +> Enter a name or IP address of a remote syslog server. +> This will send a copy of the syslog messages to the designated server. + +Mirror syslog to flash: +: + +> This setting is OFF by default and must be used with care to avoid unnecessary wear and tear of the USB device. +> +> Change this setting to YES when troubleshooting is required and it is not possible to get the regular diagnostics information. +> A mirror of the syslog file is stored in the **logs** folder of the flash device. + +  +: + \ No newline at end of file diff --git a/plugins/dynamix/event/disks_mounted/local_syslog_start b/plugins/dynamix/event/disks_mounted/local_syslog_start new file mode 100755 index 000000000..53cc13951 --- /dev/null +++ b/plugins/dynamix/event/disks_mounted/local_syslog_start @@ -0,0 +1,6 @@ +#!/bin/bash +ETC=/etc/rsyslog.conf +if grep -qP '^#\*\.\* \?remote$' $ETC; then + sed -ri 's/^#(\*\.\* \?remote)$/\1/' $ETC + /etc/rc.d/rc.rsyslogd restart &> /dev/null +fi diff --git a/plugins/dynamix/event/unmounting_disks/local_syslog_stop b/plugins/dynamix/event/unmounting_disks/local_syslog_stop new file mode 100755 index 000000000..3f2559242 --- /dev/null +++ b/plugins/dynamix/event/unmounting_disks/local_syslog_stop @@ -0,0 +1,6 @@ +#!/bin/bash +ETC=/etc/rsyslog.conf +if grep -qP '^\*\.\* \?remote$' $ETC; then + sed -ri 's/^(\*\.\* \?remote)$/#\1/' $ETC + /etc/rc.d/rc.rsyslogd restart &> /dev/null +fi diff --git a/plugins/dynamix/include/DeviceList.php b/plugins/dynamix/include/DeviceList.php index fd25d3694..575af05b2 100644 --- a/plugins/dynamix/include/DeviceList.php +++ b/plugins/dynamix/include/DeviceList.php @@ -108,7 +108,7 @@ function device_desc(&$disk) { case 'Cache' : $type = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; break; } $log = $var['fsState']=='Started' ? "" : ""; - return $log.my_id($disk['id'])." - $size $unit ({$disk['device']})"; + return $log."".my_id($disk['id'])." - $size $unit ({$disk['device']})"; } function assignment(&$disk) { global $var, $devs; @@ -425,12 +425,12 @@ case 'open': break; case 'parity': $data = []; - if ($var['mdResync']>0) { - $data[] = my_scale($var['mdResync']*1024,$unit,-1)." $unit"; - $data[] = my_clock(floor((time()-$var['sbUpdated'])/60)); - $data[] = my_scale($var['mdResyncPos']*1024,$unit)." $unit (".number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),1,$display['number'][0],'')." %)"; - $data[] = my_scale($var['mdResyncDb']*1024/$var['mdResyncDt'],$unit, 1)." $unit/sec"; - $data[] = my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0)); + if ($var['mdResyncPos']) { + $data[] = my_scale($var['mdResyncSize']*1024,$unit,-1)." $unit"; + $data[] = my_clock(floor((time()-$var['sbUpdated'])/60)).($var['mdResyncDt'] ? '' : ' (paused)'); + $data[] = my_scale($var['mdResyncPos']*1024,$unit)." $unit (".number_format(($var['mdResyncPos']/($var['mdResyncSize']/100+1)),1,$display['number'][0],'')." %)"; + $data[] = $var['mdResyncDt'] ? my_scale($var['mdResyncDb']*1024/$var['mdResyncDt'],$unit, 1)." $unit/sec" : '---'; + $data[] = $var['mdResyncDb'] ? my_clock(round(((($var['mdResyncDt']*(($var['mdResyncSize']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0)) : 'Unknown'; $data[] = $var['sbSyncErrs']; echo implode(';',$data); } else { diff --git a/plugins/dynamix/scripts/monitor b/plugins/dynamix/scripts/monitor index 30ddefce8..2411b7f98 100755 --- a/plugins/dynamix/scripts/monitor +++ b/plugins/dynamix/scripts/monitor @@ -287,7 +287,7 @@ if ($warn>0) { // process parity check, parity sync and data-rebuild notifications $name = 'parity'; $last = $saved[$item][$name] ?? ''; -if ($var['mdResync']>0) { +if ($var['mdResyncPos']) { if (!$last) { if (strstr($var['mdResyncAction'],"recon")) { $last = 'Parity sync / Data rebuild'; diff --git a/plugins/dynamix/scripts/rsyslog_config b/plugins/dynamix/scripts/rsyslog_config new file mode 100755 index 000000000..f5127da1e --- /dev/null +++ b/plugins/dynamix/scripts/rsyslog_config @@ -0,0 +1,67 @@ +#!/bin/bash + +CONF=/boot/config/rsyslog.conf +ETC=/etc/rsyslog.conf + +# read settings +source /boot/config/rsyslog.cfg + +# read $var +source /var/local/emhttp/var.ini +[[ $fsState == Started ]] || h='#' + +# create local ruleset +if ! grep -q '^\$RuleSet local$' $ETC; then + sed -ri '/^# limetech - everything goes to syslog.$/a$RuleSet local' $ETC + sed -ri '/^#?\*\.\* @@?.*:[0-9]+$/a$DefaultRuleset local' $ETC +fi + +# local syslog server +if [[ -n $local_server ]]; then + if ! grep -q '^\$RuleSet remote$' $ETC; then + sed -ri '$a\$RuleSet remote\n*.* ?remote' $ETC + fi + # enable/disable local logging + sed -ri "s/^#?(\*\.\* \?remote)$/$h\1/" $ETC + if [[ $server_protocol == tcp || $server_protocol == both ]]; then + sed -ri '/^\$InputTCPServerBindRuleset remote$/d;/^\$InputTCPServerRun [0-9]+$/d;s/^#?(\$ModLoad imtcp)/\1/' $ETC + sed -ri "\$a\\\$InputTCPServerBindRuleset remote\n\\\$InputTCPServerRun ${server_port:-514}" $ETC + [[ $server_protocol == tcp ]] && sed -ri 's/^(\$ModLoad imudp)/#\1/;/^\$InputUDPServerBindRuleset remote$/d;/^\$UDPServerRun [0-9]+$/d' $ETC + fi + if [[ $server_protocol == udp || $server_protocol == both ]]; then + sed -ri '/^\$InputUDPServerBindRuleset remote$/d;/^\$UDPServerRun [0-9]+$/d;s/^#?(\$ModLoad imudp)/\1/' $ETC + sed -ri "\$a\\\$InputUDPServerBindRuleset remote\n\\\$UDPServerRun ${server_port:-514}" $ETC + [[ $server_protocol == udp ]] && sed -ri 's/^(\$ModLoad imtcp)/#\1/;/^\$InputTCPServerBindRuleset remote$/d;/^\$InputTCPServerRun [0-9]+$/d' $ETC + fi + sed -ri "/^\\\$template remote,.*$/d;/^#\\\$UDPServerRun [0-9]+.*$/a\\\$template remote,\"${server_folder:-/mnt/user/system}/syslog-%FROMHOST-IP%.log\"" $ETC +else + sed -ri '/^\$RuleSet remote$/d;/^\*\.\* \?remote$/d;/^\$template remote,".*"$/d;/^\$Input(TCP|UDP)ServerBindRuleset remote$/d;/^\$(InputTCP|UDP)ServerRun [0-9]+$/d;s/^#?\$(ModLoad imtcp|ModLoad imudp)/#\$\1/' $ETC +fi + +# remote syslog server +if [[ -n $remote_server ]]; then + [[ $remote_protocol == udp ]] && com='@' || com='@@' + sed -ri "s/^#?(\*\.\*) @@?.*:[0-9]+$/\1 $com$remote_server:${remote_port:-514}/" $ETC +else + sed -ri 's/^#?(\*\.\* @@?.*:[0-9]+)$/#\1/' $ETC +fi + +# mirror syslog to flash +if [[ -n $syslog_flash ]]; then + if ! grep -q '^\$template flash,' $ETC; then + sed -ri '/^#\$UDPServerRun [0-9]+.*$/a$template flash,"/boot/logs/syslog"' $ETC + sed -ri '/^\*\.debug .*syslog$/a*.debug ?flash' $ETC + fi +else + sed -ri '/^\$template flash,"\/boot\/logs\/syslog"$/d;/^\*\.debug \?flash/d' $ETC +fi + +# copy conf to flash (read settings on reboot) +todos <$ETC >$CONF + +# keep local logging disabled at startup +# disk mount and disk unmount events are used to start/stop logging +sed -ri 's/^(\*\.\* \?remote)/#\1/' $CONF + +# update syslog daemon +/etc/rc.d/rc.rsyslogd restart &> /dev/null
Sync will start Parity-Sync and/or Data-Rebuild.
Read-Check in progress.
Read-Check in progress. + value="Pause" onclick="pauseParity(this.form)" value="Resume" onclick="resumeParity(this.form)"> + Cancel will stop the Read-Check.
Parity-Check in progress.
Parity-Check in progress. + value="Pause" onclick="pauseParity(this.form)" value="Resume" onclick="resumeParity(this.form)"> + Cancel will stop the Parity-Check.
Parity-Sync/Data-Rebuild in progress.
Parity-Sync/Data-Rebuild in progress. + value="Pause" onclick="pauseParity(this.form)" value="Resume" onclick="resumeParity(this.form)"> + Cancel will stop Parity-Sync/Data-Rebuild.
WARNING: canceling may leave the array unprotected!
Clearing in progress.
Clearing in progress. + value="Pause" onclick="pauseParity(this.form)" value="Resume" onclick="resumeParity(this.form)"> + Cancel will stop Clearing.
Current operation started on