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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Port monitor script

Status
Not open for further replies.

sjcrane

MIS
Jan 18, 2006
41
US
I have a port monitoring script that monitors a port and alerts when it is down. I would like to send a string to a file to build a histogram.


Now I have:

netstat -Aan|grep 4446 1>/dev/null
RC=$?
echo RCb $RC
if [[ ${RC} -eq 1 ]]
then
# echo "Mailing"
mail -s "MIDAS Broker 4446 is unavailable" scrane@grhc.org</usr/local/scripts/broker_msg/broker4446_restart.txt
#mail -s "Production Broker 4446 is unavailable" scrane@grhc.org </usr/local/scripts/broker_msg/broker4446_restart.txt
date >> /usr/local/scripts/midis_histogram.txt
elif [[ ${RC} -eq 0 ]]
then
echo exiting
fi

exit 0


I would like the "date >> /usr/local/scripts/midis_histogram.txt" to get populated as follows:

# cat midis_histogram.txt
Thu May 10 09:15:06 MST 2012, UP
Thu May 10 09:17:17 MST 2012, DOWN
Thu May 10 09:20:00 MST 2012, UP
Thu May 10 09:30:05 MST 2012, UP
 
As an aside, I'd ask the tek-tips admin to remove your mail address from this post I now know that ####.org use AIX and have port 4446 open.

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top