Dashboard: fix stream counters

This commit is contained in:
bergware
2023-12-18 11:29:44 +01:00
parent eb88e9c4f5
commit f5f0c31276
2 changed files with 2 additions and 2 deletions

View File

@@ -454,7 +454,7 @@ if (_var($var,'shareSMBEnabled')=='yes') {
$comment = $share['comment'] ?: ' ';
$security = export_settings(_var($var,'shareSMBEnabled'), $sec[$name]);
$last = $name==array_key_last($shares) ? ' last' : '';
echo "<tr class='smb share share1{$last}'><td><span class='w26'><i class='icon-folder f14'></i>$list</span><span class='w44'>$comment</span><span class='w18'>$security</span><span id='share".$i++."'>0</span></td></tr>";
echo "<tr class='smb share share1{$last}'><td><span class='w26'><i class='icon-folder f14'></i>$list</span><span class='w44'>$comment</span><span class='w18'>$security</span><span id='share",$i++,"'>0</span></td></tr>";
}
if (!count($shares)) echo "<tr class='smb share share1'><td class='none'>"._("No shares present")."</td></tr>";
}

View File

@@ -92,7 +92,7 @@ while (true) {
// add fans information
if (count($fans)) $echo['fan'] = array_map(function($fan){return "$fan RPM";},$fans);
// add streams information
exec("LANG='en_US.UTF8' lsof -Owl /mnt/disk[0-9]* 2>/dev/null|awk -F/ '/^shfs/{print \$4}'",$lsof);
exec("LANG='en_US.UTF8' lsof -Fn /mnt/disk[0-9]* 2>/dev/null|awk -F/ '(NR>1){print \$4}'",$lsof);
$share = array_keys(parse_ini_file("$varroot/shares.ini",true));
$count = array_count_values($lsof);
foreach ($share as $name) $echo['stream'][] = $count[$name]??0;