danjerman_19651
Mar 09, 2010Nimbostratus
v9.4.5 external monitor not running
Hi,
I'm having issues running an external monitor. The code has been copied over from a v4 box and the paths and syntax amended to try and make it work with v9. I didn't write the original script.
The script runs from the command line ok but I don't see it running on the box when configured as a node monitor. The pid file doesn't get created and neither do I see it running when doing a ps. On the v4 box, I constantly see the pid files coming and going as the monitor runs and the processes in ps.
The script :
!/usr/bin/perl
use Socket;
The script prints something if finds the word "Available" in the page /test/status.html
It takes the hostname as the only parameter
sub open_TCP
{
get parameters
my ($FS, $ipvalue, $port, $poolname) = @_;
my $proto = getprotobyname('tcp');
socket($FS, PF_INET, SOCK_STREAM, $proto);
my $sin = sockaddr_in($port,inet_aton($ipvalue));
connect($FS,$sin) || return undef;
my $old_fh = select($FS);
$| = 1; don't buffer output
select($old_fh);
1;
}
$pidfile="/var/run/pinger.$1..$2.pid";
`kill -9 `cat $pidfile` > /dev/null 2>&1`;
$ipvalue = $ARGV[0];
$port = $ARGV[1];
$poolname = $ARGV[2];
$statefile="/tmp/down_$ARGV[1]_$ipvalue";
$logfile="/var/log/ltm";
if (open_TCP(F, $ipvalue, 80) == undef)
{
`/bin/bigpipe pool $poolname member $ipvalue:$port down`;
`/bin/touch $statefile`;
exit(-1);
}
else
{
if ( -e $statefile )
{
`/bin/bigpipe pool $poolname member $ipvalue:$port up`;
`rm -f $statefile`;
}
send the GET method with / as a parameter
print F "GET /test/status.html\n\n";
$available=0;
get the response
while($return_line=
{
if($return_line =~ /Available/)
{
$available=1;
}
}
close(F);
print "$available\n";
if($available==1)
{
print "it is up\n";
`/bin/bigpipe pool $poolname member $ipvalue:$port session enable`;
}
else
{
`/bin/bigpipe pool $poolname member $ipvalue:$port session disable`;
}
}
When I run it from the command line, I get this :
./v9script.pl x.x.x.x 80 v9poolname
1
it is up
I have chmod'd the file to 777 so it is executable but i just dont see anything occurring on the box when it is applied.
Any assistance will be gratefully received. I am using 9.4.5 build 1086.1
TIA
DM
D