Loading freifunk.sh 0 → 100644 +34 −0 Original line number Diff line number Diff line TIME=$(date +%s) STEP=120 function display { # $1: first line # $2: 2nd line echo -ne '\e[1;1H\e[2J' # reset display content and cursor echo -n "$1" echo -ne '\n' # move to second line echo -n "$2" } function show_bw { RX=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=total_traffic_rx_bits_per_second&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) TX=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=total_traffic_tx_bits_per_second&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) RX=$(bc <<< "scale=1; $RX/1024/1024") TX=$(bc <<< "scale=1; $TX/1024/1024") display "$RX MBit/s down" "$TX MBit/s up" } function show_users { CLIENTS=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=total_clients&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) NODES=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=meshnodes_online_total&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) display "$CLIENTS Clients" "$NODES Knoten" } while true; do show_bw sleep 5 show_users sleep 5 done Loading
freifunk.sh 0 → 100644 +34 −0 Original line number Diff line number Diff line TIME=$(date +%s) STEP=120 function display { # $1: first line # $2: 2nd line echo -ne '\e[1;1H\e[2J' # reset display content and cursor echo -n "$1" echo -ne '\n' # move to second line echo -n "$2" } function show_bw { RX=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=total_traffic_rx_bits_per_second&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) TX=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=total_traffic_tx_bits_per_second&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) RX=$(bc <<< "scale=1; $RX/1024/1024") TX=$(bc <<< "scale=1; $TX/1024/1024") display "$RX MBit/s down" "$TX MBit/s up" } function show_users { CLIENTS=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=total_clients&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) NODES=$(curl -s "https://mgmt.saar.freifunk.net/grafana/api/datasources/proxy/1/api/v1/query_range?query=meshnodes_online_total&start=$TIME&end=$TIME&step=$STEP" | jq .data.result[0].values[0][1] | cut -d '"' -f 2) display "$CLIENTS Clients" "$NODES Knoten" } while true; do show_bw sleep 5 show_users sleep 5 done