Forum Discussion
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...
danjerman_19651
Mar 11, 2010Nimbostratus
I 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)
Here is the original v4 script. Its a legacy setup and the app needs the node to be disabled rather than marked down (Well, it did in v4...I'm trying to get the app guys to do some serious testing with me with v9 to see if we actually need the script in v9...however, its not clear exactly why this was setup this way to begin with tbh)
!/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) = @_;
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];
$statefile="/tmp/down_$ARGV[1]_$ipvalue";
$logfile="/var/log/bigd";
if (open_TCP(F, $ipvalue, 80) == undef)
{
`/sbin/bigpipe node $ipvalue:$port down`;
`/usr/bin/touch $statefile`;
exit(-1);
}
else
{
if ( -e $statefile )
{
`/sbin/bigpipe node $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";
`/sbin/bigpipe node $ipvalue:$port enable`;
}
else
{
`/sbin/bigpipe node $ipvalue:$port disable`;
}
}
Cheers
DM
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects