rajaniyer123,
For the short term, depending on what you need, you might be able to do something, simple, and brute force such as this:
Code:
#!/bin/bash
dropped_count=`/sbin/ifconfig eth0 | fgrep 'RX packets' | cut -d: -f3-3 | cut -d' ' -f1`
while [[ 1 -eq 1 ]]
do
if [[ $dropped_count -gt 100 ]]
then
# Put actual ALERT logic here instead of the echo.
echo ALERT
fi
sleep 60
done
But long term, if I wanted to monitor dropped packets, especially if I thought I might need to do something more involved with it in the future, then for the sake of elegance, I might look into something like extending iptables, building a custom module, so I could launch whatever program I wished, when a threshold was exceeded.
Hope this helps.