#!/bin/sh
#
#File: /users/krowe/droprate.sh 
#Author: K._Scott Rowe 
#Time-stamp: <09/28/2022 11:27:17 krowe@naasc-vs-2>

SLEEP=10
iface=${1}

dropped_old=$(ifconfig ${iface} | grep "RX errors" | awk '{print $5}')
sleep ${SLEEP}

while [ 1 ] ; do
    dropped_new=$(ifconfig ${iface} | grep "RX errors" | awk '{print $5}')
    num=$(expr ${dropped_new} - ${dropped_old})
    dropped_old=${dropped_new}
    echo "Last ${SLEEP} seconds.  Dropped packets (${num})"
    sleep ${SLEEP}
done
