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