fff-web: Suppress error if WAN/mesh statistics files are missing
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
This commit is contained in:
parent
fb757c6f8f
commit
dbc1dddb23
|
@ -3,15 +3,16 @@
|
|||
<%
|
||||
human_bytes() {
|
||||
while read B ; do
|
||||
[ $B -lt 1024 ] && echo ${B} B && break
|
||||
[ $B -lt 1024 ] && echo ${B} B && return
|
||||
KB=$(((B+512)/1024))
|
||||
[ $KB -lt 1024 ] && echo ${KB} KB && break
|
||||
[ $KB -lt 1024 ] && echo ${KB} KB && return
|
||||
MB=$(((KB+512)/1024))
|
||||
[ $MB -lt 1024 ] && echo ${MB} MB && break
|
||||
[ $MB -lt 1024 ] && echo ${MB} MB && return
|
||||
GB=$(((MB+512)/1024))
|
||||
[ $GB -lt 1024 ] && echo ${GB} GB && break
|
||||
echo $(((GB+512)/1024)) TB
|
||||
[ $GB -lt 1024 ] && echo ${GB} GB && return
|
||||
echo $(((GB+512)/1024)) TB && return
|
||||
done
|
||||
echo "-"
|
||||
}
|
||||
|
||||
show_msg() {
|
||||
|
|
|
@ -71,8 +71,8 @@ fi
|
|||
<legend>Netz: Freifunk</legend>
|
||||
<table>
|
||||
<tr><th>Nutzer:</th><td><% cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W' %></td></tr>
|
||||
<tr><th>Empfangen:</th><td><% cat /sys/class/net/br-mesh/statistics/rx_bytes | human_bytes %></td></tr>
|
||||
<tr><th>Gesendet:</th><td><% cat /sys/class/net/br-mesh/statistics/tx_bytes | human_bytes %></td></tr>
|
||||
<tr><th>Empfangen:</th><td><% cat /sys/class/net/br-mesh/statistics/rx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>Gesendet:</th><td><% cat /sys/class/net/br-mesh/statistics/tx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>IPv4 Adressen:</th><td><% addr 4 br-mesh %></td></tr>
|
||||
<tr><th>IPv6 Adressen:</th><td><% addr 6 br-mesh %></td></tr>
|
||||
</table>
|
||||
|
@ -82,8 +82,8 @@ fi
|
|||
<legend>Netz: WAN</legend>
|
||||
<table>
|
||||
<tr><th>Internet vorhanden:</th><td><%= ${internet_active} %></td></tr>
|
||||
<tr><th>Empfangen:</th><td><% cat /sys/class/net/${wanif}/statistics/rx_bytes | human_bytes %></td></tr>
|
||||
<tr><th>Gesendet:</th><td><% cat /sys/class/net/${wanif}/statistics/tx_bytes | human_bytes %></td></tr>
|
||||
<tr><th>Empfangen:</th><td><% cat /sys/class/net/${wanif}/statistics/rx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>Gesendet:</th><td><% cat /sys/class/net/${wanif}/statistics/tx_bytes 2> /dev/null | human_bytes %></td></tr>
|
||||
<tr><th>IPv4 Adressen:</th><td><% addr 4 $wanif %></td></tr>
|
||||
<tr><th>IPv6 Adressen:</th><td><% addr 6 $wanif %></td></tr>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue