wiedehopf / graphs1090

Graphs for readsb / dump1090-fa / dump1090 (based on dump1090-tools by mutability)
MIT License
409 stars 43 forks source link

network_graph() always reads ethernet data if only one interface found #67

Open MartinCRichards opened 1 year ago

MartinCRichards commented 1 year ago

Apologies in advance for any etiquette errors... first-time user of github!

I installed readsb, tar1090 and then graphs1090 on a Pi Zero W which only has wifi, no ethernet.

collectd.conf has been correctly configured for wlan0 but if there are less than 2 interfaces found, the network_graph() function only reads ethernet data

suggested change in behaviour: always check for presence of $ether, $wifi rather than just interface count

workaround: set ether=wlan0 in config file /etc/defaultgrapsh1090

network_graph() {
    $pre
    if [[ $(ls ${DB}/localhost | grep interface -c) < 2 ]]
    then
        interfaces=(\
            "DEF:rx_b=$(check $2/$ether/if_octets.rrd):rx:AVERAGE" \
            "DEF:tx_b=$(check $2/$ether/if_octets.rrd):tx:AVERAGE" )
    else
        interfaces=(\
            "DEF:rx1=$(check $2/$wifi/if_octets.rrd):rx:AVERAGE" \
            "DEF:tx1=$(check $2/$wifi/if_octets.rrd):tx:AVERAGE" \
            "DEF:rx2=$(check $2/$ether/if_octets.rrd):rx:AVERAGE" \
            "DEF:tx2=$(check $2/$ether/if_octets.rrd):tx:AVERAGE" \
            "CDEF:rx_b=rx1,rx2,ADDNAN" \
            "CDEF:tx_b=tx1,tx2,ADDNAN")
    fi
    <snip>    
wiedehopf commented 1 year ago

It's just called ethernet... if you only have wifi whatever. It'll be one graph is there actual a data issue or is this just label stuff?

MartinCRichards commented 1 year ago

If you only have wifi and no ethernet then no bandwidth data is displayed. I think this test:

if [[ $(ls ${DB}/localhost | grep interface -c) < 2 ]]

means that it only looks for the $ether data but there isn't any :-(

wiedehopf commented 1 year ago
if [[ -n $ether ]]; then
    ether="interface-${ether}"
else
    ether="$(ls ${DB}/localhost | grep -v 'interface-lo' | grep interface -m1)"
fi

Please describe your actual symptoms.

ls /run/collectd/localhost | grep interface

Let's check this for starters.