P
Prabh
Hello all,
I need to monitor availability of a webserver for x no. of sec.s and
trigger
an alert mechanism after the time elapses and webserver still doesnt
respond.
Am thinking of using the 'alarm' function to do this, along the lines,
==========================================
use LWP::Simple ;
alarm(60) ;
my $url = head("http://abc.xyz.com") ;
==========================================
When the webserver doesnt respond after 60 sec.s, I want to shoot off
a mail to the webadmins that the webserver isnt responding. So, where
do I get the "at this point 60 sec.s have elapsed and theres no
reponse from webserver, its ok to send mail now" point.
Paraphrasing the alarm example from the Camel book:
===========================================
print "Answer in 60 sec.s\n" ;
alarm(60) ;
$answer = <STDIN> ;
$timeleft = alarm(0) ;
print "You had $timeleft sec.s remaining.\n" ;
===========================================
I here, where do I print "Hey, 60 sec.s elapsed and you still didnt
answer. Goodbye." All I get after 60 sec.s is the message "Alarm
clock". I dont know where its coming from.
Thanks for your time,
Prab
I need to monitor availability of a webserver for x no. of sec.s and
trigger
an alert mechanism after the time elapses and webserver still doesnt
respond.
Am thinking of using the 'alarm' function to do this, along the lines,
==========================================
use LWP::Simple ;
alarm(60) ;
my $url = head("http://abc.xyz.com") ;
==========================================
When the webserver doesnt respond after 60 sec.s, I want to shoot off
a mail to the webadmins that the webserver isnt responding. So, where
do I get the "at this point 60 sec.s have elapsed and theres no
reponse from webserver, its ok to send mail now" point.
Paraphrasing the alarm example from the Camel book:
===========================================
print "Answer in 60 sec.s\n" ;
alarm(60) ;
$answer = <STDIN> ;
$timeleft = alarm(0) ;
print "You had $timeleft sec.s remaining.\n" ;
===========================================
I here, where do I print "Hey, 60 sec.s elapsed and you still didnt
answer. Goodbye." All I get after 60 sec.s is the message "Alarm
clock". I dont know where its coming from.
Thanks for your time,
Prab