Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Snoop Script

Status
Not open for further replies.

tafil

ISP
Jul 29, 2008
1
hi all,
i want to make a script that use the snoop command to check if there is traffic on port 123 ip address 10.*.*.* if they is traffic it is okay if not the script should send a e-mail.
I make this but i want to make it better.
Does anybody have any idea or any sample script?

This is what i did

if [ `snoop -c 50 -p 23 10.*.*.* 10.*.*.* | awk '/TELNET/ {print $8}'` ]
then
echo "OK"
else
echo "Is not working (send mail)"
fi


Thanks in advance
 
I'm not sure there's much improvement needed. I can't see the need for awk though. Maybe
Code:
if snoop -c 50 -p 23 "10.*.*.*" "10.*.*.*" | grep -q TELNET 
then
  echo OK
else
  echo It\'s Broken | mail -s "no telnet on port 23" Me@myserver
fi

On the internet no one knows you're a dog

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top