Forum Discussion
kykong_107132
Nimbostratus
Dec 06, 2005external mointor
Hi All,
Actually I not sure whether this the correct place for me to post this question. previously in version4.5 PTF 10, i'm using a external monitoring using perl script to monitor DNS server health. it work fine.
But when I move the script to v9.2, the monitoring fail. no sure what's the problem.
Appreciate that anyone can give me some help..
below is my bigip config and script file
============bigip.conf==================
monitor testdns {
defaults from external
args "www.test.com"
run "/usr/bin/monitors/DNS_pinger"
}
========================================
=========DNS_pinger=====================
!/usr/bin/perl -w
use strict;
use Net::DNS;
require 5.005;
my ($node, $port, @domain) = @ARGV;
Derive and untaint programname.
my $programname = '/' . $0;
$programname =~ m/^.*\/([^\/]+)$/;
$programname = $1;
$node =~ m/^(\d+\.\d+\.\d+\.\d+)$/;
$node = $1;
$port =~ m/^(\d+)$/;
$port = $1;
Process ID and file where it's to be stored. The format
is significant.
my $pidfile = "/var/run/$programname.$node..$port.pid";
my $pid = "$$";
Maintenence. Clean up any existing EAV.
if (-f $pidfile ) {
open(PID, "<$pidfile");
my $pid = ;
close(PID);
if ( $pid ) {
chomp $pid; $pid =~ m/^(\d+)$/; $pid = $1;
if ( $pid ) {
kill 9, $pid;
}
}
unlink($pidfile);
}
Create a new maintenence file.
open(PID, ">$pidfile");
print PID $pid, "\n";
close(PID);
Connect to the DNS server.
Perform A record lookup
my $res = Net::DNS::Resolver->new;
$res->nameservers($node);
my $ipquery = $res->search("@domain");
if (!($ipquery))
{
print STDERR "Failed to connect, ", $res->errorstring, "\n";
unlink($pidfile);
exit 1;
}
print "up\n";
Clean up.
unlink($pidfile);
exit 0;
==================================================================
regards
regards
- David_Kirlin_23
Nimbostratus
We seem to have the same issue when we upgraded, the Pool always thinks it is up, regardless of what the external monitoring script says. We haven't resolved it either. - David_Kirlin_23
Nimbostratus
Contrary to what is in the /usr/bin/monitors/sample_monitor it looks like the external monitors now operate in such a way that if the script outputs anything, such as "foo", then the system is up and if it outputs nothing the system is down. At least my initial testing seems to indicate that as the possible reason our script no longer operates. - David_Kirlin_23
Nimbostratus
I take that back, the sample_monitor doesn't do that, it was my own dumb fault. - Deb_Allen_18Historic F5 AccountAs it seems you've discovered, monitors have always taken ANY output by the script to stdout as an indication that the node is responding as expected.
node_ip=`echo $1 | sed 's/::ffff://'`
$node =~ m/^(\d+\.\d+\.\d+\.\d+)$/; $node = $1;
(Grabs the end of $node if it matches the dotted-quad address format.)$node =~ m/(\d+\.\d+\.\d+\.\d+)$/;
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