Forum Discussion
v9.4.5 external monitor not running
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
- hooleylistCirrostratusOne thing to add is handling for IPv6 addresses that LTM uses internally:
- danjerman_19651NimbostratusIs the IPv6 thing essential ?
- hooleylistCirrostratusbigd uses ::ffff:w.x.y.z where w.x.y.z is the IPv4 address, so yes, it's essential to remove that from the IP you reference in your script.
- danjerman_19651NimbostratusThanks Aaron, I'll try and strip the IPv6 bit in perl then.
- hwidjaja_37598AltostratusDo you see any error message in the log files? Verify the path, can u send us these:
- hwidjaja_37598AltostratusI think your script is expecting for a pool name as the third argument. By default, ltm is only passing 2 arguments (IP and port number):
- danjerman_19651NimbostratusDo you see any error message in the log files?
- danjerman_19651Nimbostratus
- hwidjaja_37598AltostratusCan you try removing the IP and Port from monitor's args?
- danjerman_19651NimbostratusI removed the ip and port from the supplied args and the only difference was that it seems to mark the node down quicker. (i.e. failed rather than timed out)
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com